JavaRush /Java Blog /Random EN /Brain fitness. Current tasks for upgrading programming sk...

Brain fitness. Current tasks for upgrading programming skills

Published in the Random EN group
As we know, programmers on a regular basis have to think, analyze and sometimes find non-obvious solutions to various problems, large and small. To do this, coders are forced to actively use their brain, which is already an extremely “expensive” toy - the human brain, having a mass of no more than 1.5-2% of body weight, consumes about 25% of all energy. And this is for the average person, and what percentage of energy is “consumed” by the brain of a programmer actively working on a complex project is scary to imagine (and scientists, most likely British, have yet to establish the exact indicator). Brain fitness.  Current tasks for upgrading programming skills - 1What conclusion can be drawn from all this? To become a good programmer, and then to remain one, you need to pump up your brain, teaching it to think and find solutions without excessive stress and on a regular basis. Trite, like all really effective methods, but effective. To help you keep the gray matter in your skull in good shape, today we have prepared a selection of good resources with puzzles and puzzles for programmers, and also translated several interesting problems from English.

Websites with tasks for programmers

Almost all of the resources in the collection are in English, so you will have the opportunity not only to practice solving coding problems and puzzles, but also to get additional practice in using English in programming. Brain fitness.  Current tasks for upgrading programming skills - 2
  1. Coderbyte

    One of the most popular English-language resources with tasks for programmers. On it you can find more than 200 tasks of varying levels of complexity, which can be solved directly on the site online using one of the 10 available programming languages ​​(including Java).

  2. Programming Praxis

    Programming Praxis is a popular blog that regularly publishes various interesting and, most importantly, relevant tasks for programmers. Common for a range of programming languages. The challenges are designed to help coders get up to speed with the latest changes in technology and approaches to programming in practice.

  3. TopCoder

    TopCoder is an active community of programmers who love to develop and solve various problems. New tasks are regularly published, the successful solution of which will not only provide an opportunity to practice and increase your HR, but also receive cash prizes.

  4. CodeKata

    CodeKata is a blog with a lot of quite original and witty problems for programmers, invented by Dave Thomas, one of the authors of the famous book Pragmatic Programmer (“The Pragmatic Programmer. The Path from Apprentice to Master”). The problems on the CodeKata website are diverse, and the solutions are relevant to real programming work.

  5. Peking University JudgeOnline for ACIP/ICPC

    Peking University JudgeOnline for ACIP/ICPC is a page of Peking University that contains tasks for programmers from various competitions and competitions. The site is regularly updated, problems can be solved in real time, and solutions are evaluated by a commission of Peking University experts.

  6. Project Euler

    Another old well-known site with serious and non-trivial tasks. “Project Euler is a collection of complex mathematical and programming problems that require more than just knowledge of mathematics to solve. Problems vary in complexity and the approach is based on inductive chain learning. That is, having solved one problem, you will discover a new concept that will allow you to solve other problems that were previously inaccessible to understanding,” say the creators of the resource.

  7. The Daily WTF

    The Daily WTF is another popular programming community that operates on the Bring Your Own Code (BYOC) principle, meaning developers share their own source code to solve various original problems. “The purpose of BYOC is simple: to provide you, as a software developer, with the opportunity to improve your programming skills by solving a problem that is a little more interesting than the usual, boring stuff,” the site says.

  8. Tproger

    An excellent Russian-language site with algorithmic tasks that are used to test the skills of specialists during technical interviews in companies such as Google, Facebook and others. There are many problems presented, including original ones, of varying levels of difficulty.

  9. Al Zimmermann's Programming Contests

    A well-known author's site where “crazy programmers compete for fame and cool prizes.” Competitions are held once or twice a year, and the names of distinguished programmers are published on the main page of the resource, which certainly attracts interest from promising employers.

  10. Timus Online Judge

    One of the largest Russian-language archives of programming problems with an automatic checking system. The main source of tasks for the archive is competitions at the Ural Federal University, Ural Championships and other regional programming events. Timus Online Judge also allows you to take part in online versions of most competitions that regularly take place at the Ural Federal University.

5 interesting tasks

Here are some interesting puzzles for those who can't wait to get started. Brain fitness.  Current tasks for upgrading programming skills - 3
  1. Blender riddle from Steve Jobs

    Challenge: You are shrunk down to the size of a nickel and thrown into a blender. Your weight has decreased so that your body density remains the same. The blades will begin to rotate after 60 seconds. Your actions?

    This is a classic task usually associated with Steve Jobs, the founder of Apple. When Jobs returned to Apple in 1997, he personally interviewed every employee at the company and used this task as one of his first tests.


    У данной задачи больше одного решения, так How она служит для того, чтобы оценить креативность сотрудника, умение быстро находить выход из стрессовой ситуации и неординарно мыслить. Вот наиболее классический вариант решения: лечь How можно плотнее к днищу блендера, чтобы его лезвия крутorсь над вами.

  2. Сколько людей было на конференции?

    Задача: На конференции каждый гость пожал руку всем остальным. Было 66 рукопожатий. Сколько человек было на научной конференции?

    Другая классическая программистская задача из тех, которые часто дают на первых этапах технических собеседований.

    Классическое решение:

    Допустим, на конференции было n человек. Первый человек пожимает руку всем остальным: n-1 раз (n-1 человек). Второй человек пожимает руку всем остальным (но не первому, так How это уже было сделано): n-2 раза. 3-й человек пожимает руку всем остальным: n-3.

    Таким образом, общее количество рукопожатий будет = (n-1) + (n-2) + (n-3) + …… 0;
    = (n-1) * (n-1 + 1) / 2 = (n-1) * n / 2 = 66
    = n ^ 2 -n = 132
    = (n-12) (n + 11) = 0;
    = n = 12 ИЛИ n = -11

    Вариант -11 исключен, поэтому ответ: 12 человек.

  3. Бар и 25 стульев.

    Еще одна классическая и весьма остроумная задачка, на этот раз посложнее.

    Задача: Есть бар с 25-ю стульями, которые расположены в линию. Посетители этого бара — антисоциальные личности, поэтому, когда они заходят в бар, то всегда стараются найти место How можно дальше от остальных. Если постоянный посетитель заходит в бар и обнаруживает, что свободного места без соседства с кем-либо нет, он разворачивается и уходит. Владелец бара, естественно, хочет видеть можно больше посетителей. Владелец может указать место, на которое нужно сесть, только первому клиенту, тогда How все остальные сами выберут себе самое дальнее место от других. Предположим, что места пронумерованы от 1 до 25. Какое место должно быть занято первым?


    Первый человек должен сесть на стул 9 or 17 (из-за симметрии, не имеет значения, Howое именно из двух мест). Предположим, он выбирает место 9. Следующий человек выберет место 25, так How оно самое дальнее от места 9. Следующие два человека займут места 1 и 17. Следующие три займут 5, 13 и 21. Следующие шесть будут занимать стулья 3, 7, 11, 15, 19 и 23. Таким образом, в баре разместится максимум 13 человек, и никто не будет сидеть рядом с другим человеком. Если место, отличное от 9 or 17, будет выбрано первым, общее количество посетителей бара будет меньше 13.

  4. Деньги в карманах и религия.

    Интересно составленная задача на нахождение алгоритма.

    Problem: A man has money in his pocket, the total amount of which is from 90 to 95 dollars. Along the way he visits several temples. As soon as he enters a temple, his money is doubled, and he ends up donating $100 to each temple. As a result, his pocket becomes empty after visiting the last temple. Now the question is: how much money did he have initially and how many temples did he visit?


    We start counting from the last temple:

    After visiting the last temple (1) he had 0 money left, so => ​​(0 + 100) / 2 = 50. He had 50 dollars before visiting the last temple

    Before visiting the previous temple (2), he had (50 + 100) / 2 = 75.
    Before visiting the previous temple (3), he had (75 + 100) / 2 = 87.5.
    Before visiting the previous temple (4), he had (87.5 + 100) / 2 = 93.75.
    Before visiting the previous temple (5), he has (93.75 + 100) / 2 = 96.875 - the amount exceeds the initial conditions.
    Answer: The person originally had $93.75 and visited 4 temples.

  5. An incident in the field.

    And finally, another old classic, one might even say accordion-like, logical thinking problem.

    Problem: A dead man was found in a wheat field. He held the match tightly in his hands. Why did the person die?


    The man was flying on a plane with three fellow passengers. The engine stalled and the plane began to fall. The men discovered that there were only three parachutes for four of them and began to pull matches. One of them pulled out a short one and was forced to jump without a parachute.


Well, for those who find these problems too simple or too general, we have more complex Java problems , including tricky problems that are often given during interviews for Java programmers. If you know interesting puzzles for programmers or want to share your favorite task, write in the comments.