JavaRush /Java Blog /Random EN /Brain fitness. Actual tasks for pumping programming skill...

Brain fitness. Actual tasks for pumping programming skills

Published in the Random EN group
As we know, programmers on a regular basis have to think, analyze and find sometimes 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 it’s scary to imagine what percentage of energy the brain of a programmer actively working on a complex project “eats up” (and scientists, most likely British, have yet to establish the exact figure). Brain fitness.  Actual tasks for pumping programming skills - 1What conclusion can be drawn from all this? To become a good programmer and then remain one, you need to pump your brain, teaching it to think and find solutions without undue 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, as well as translated from English a few interesting tasks.

Sites with tasks for programmers

Almost all 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 get additional practice in using English in programming. Brain fitness.  Actual tasks for pumping programming skills - 2
  1. coderbyte

    One of the most popular English resources with tasks for programmers. On it you can find more than 200 tasks of different 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 where various interesting and, most importantly, relevant tasks for programmers are published on a regular basis. Usually for a number of programming languages. The tasks are designed to help coders get up to speed with the latest developments in technology and practical programming approaches.

  3. TopCoder

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

  4. CodeKata

    CodeKata is a blog with a lot of rather original and witty problems for programmers, invented by Dave Thomas, one of the authors of the famous book Pragmatic Programmer (“Pragmatic Programmer. The path from apprentice to master”). The tasks on the CodeKata site 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, which contains problems for programmers from various competitions and competitions. The site is regularly updated, tasks can be solved in real time, and solutions are evaluated by a commission of experts from Peking University.

  6. Project Euler

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

  7. The Daily WTF

    The Daily WTF is another popular Bring Your Own Code (BYOC) community of programmers, which means that developers share their own source code to solve various original problems. “The goal of BYOC is simple: to give you, as a software developer, the opportunity to improve your programming skills in solving a problem that is a little more interesting than the usual, boring things,” 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 tasks, including original ones, of different levels of complexity.

  9. Al Zimmermann's Programming Contests

    A well-known author 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 the competitions of the Ural Federal University, the Ural Championships and other regional programming events. Timus Online Judge also allows you to take part in online versions of most competitions that are regularly held at the Ural Federal University.

5 interesting tasks

Here are some interesting puzzles for those who can't wait to get started. Brain fitness.  Actual tasks for pumping programming skills - 3
  1. The Blender Mystery by Steve Jobs

    Task: You were reduced to the size of a 5 cent coin 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 that is usually associated with Steve Jobs, the founder of Apple. When Jobs returned to Apple in 1997, he personally interviewed every employee in the company and used this task as one of his first tests.

    Solution:

    This task has more than one solution, as it serves to evaluate the employee's creativity, the ability to quickly find a way out of a stressful situation and think out of the box. Here is the most classic solution: lie as close as possible to the bottom of the blender so that its blades spin above you.

  2. How many people were at the conference?

    Task: At the conference, each guest shook hands with everyone else. There were 66 handshakes. How many people were at the scientific conference?

    Another classic programming challenge often given in the early stages of technical interviews.

    Classic solution:

    Let's say there were n people at the conference. The first person shakes hands with everyone else: n-1 times (n-1 people). The second person shakes hands with everyone else (but not the first, since this has already been done): n-2 times. 3rd person shakes hands with everyone else: n-3.

    Thus, the total number of handshakes will be = (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 OR n = -11

    Option -11 is excluded, so the answer is: 12 people.

  3. Bar and 25 chairs.

    Another classic and very witty puzzle, this time more difficult.

    Task: There is a bar with 25 chairs arranged in a line. The patrons of this bar are anti-social personalities, so when they enter the bar, they always try to find a place as far away from the rest as possible. If a regular visitor enters the bar and finds that there is no free place without a neighborhood with someone, he turns around and leaves. The bar owner naturally wants to see as many patrons as possible. The owner can indicate the place to sit only to the first client, while everyone else will choose the farthest seat from the others. Suppose the seats are numbered from 1 to 25. Which seat should be taken first?

    Solution:

    The first person should sit on chair 9 or 17 (because of the symmetry, it doesn't matter which of the two seats). Suppose he chooses seat 9. The next person will choose seat 25 since it is the furthest from seat 9. The next two people will occupy seats 1 and 17. The next three will occupy seats 5, 13 and 21. The next six will occupy chairs 3, 7, 11 , 15, 19 and 23. Thus, the bar will accommodate a maximum of 13 people, and no one will sit next to another person. If a seat other than 9 or 17 is chosen first, the total number of bar patrons will be less than 13.

  4. Money in pockets and religion.

    An interestingly formulated problem for finding an algorithm.

    Task: A person 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 the temple, his money is doubled, and when he leaves, he donates $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?

    Solution:

    We start the countdown from the last temple:

    He had 0 money left after visiting the last temple (1), so => ​​(0 + 100) / 2 = 50. He had $50 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 sum exceeds the initial conditions.
    Answer: The person originally had $93.75 and visited 4 temples.

  5. case in the field.

    And finally, one more old classic, one might even say button accordion, task for logical thinking.

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

    Solution:

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

Brain fitness.  Actual tasks for pumping programming skills - 4

Epilogue

Well, for those who found these puzzles too simple or overly general, we have more complex Java problems , including trick problems that are often given in interviews for Java programmers. If you know interesting puzzles for programmers or want to share your favorite task, write in the comments.
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION