Three tasks for programmers who don't need math

    The ancient holivar about whether a programmer needs mathematics received an unexpected continuation in disputes about the exam. The idea that it is not necessary to test knowledge at all, but to test the ability to quickly search for answers, began to move forward. Well, as a conclusion - the replacement of the exam in the championship on search in Google / Yandex. In my opinion, with the same success, you can conduct an exam in the form of a search in the school library. For some reason, no one notices such an obvious truth that those who know what to look for quickly find answers, that is, they just have knowledge. To confirm this idea, I made 3 tasks for programmers, the algorithms of which I would find in a couple of minutes.
    Try it and you do it. It seems to me that only people who have good knowledge of mathematics will be able to cope quickly. If you cannot succeed quickly, then think about how much information you cannot find simply because ignorance of mathematics does not allow you to formulate the question normally.

    Task 1: The security guard at the enterprise must work 6 days in April (from 00:00 to 23:59). Print all the ways of arranging these 6 days in the format 00100111000, where 0 is the day off, 1 is the working day. The guard can work for 6 days in a row.
    Task 2:The director of the company, Melkosoft, set the task for you to write a screensaver in which the maze is simulated by the rule of the left hand from a random point. The second programmer wrote a function that generates connected labyrinths (you can go to any point from any point), but in some cases a round by the left rule becomes a round in a circle around the wall. It is necessary to add new walls to the labyrinth so that it remains connected, but there would be no circular paths in it, at which not the whole labyrinth goes around.
    Task 3:The first player has N coins, and the second one does not have them at all. Players decide whose move is tossing a coin. If you walked first, then he puts 1 coin on the table. If the second - he takes 1 coin from the table, if the table is not empty. As soon as one player has made N moves, only the other goes further, until he also makes N moves. How many coin drop sequences are there in which the second player takes all the coins?
    Example 1: N = 4. 11112222. With this sequence of moves, first the first will lay out N coins, and then the second will take them all. The second won.
    Example 2: N = 1. 21. During the turn of the second player, the table is still empty, so he will not take a single coin and lose.

    What would I look for? After a little thought, I would drive into a search engine:
    Task 1: Generate Combinations
    Task 2: Spanning Tree
    Task 3: Catalan Numbers


    UPD Important


    The task was not to solve these problems at any cost (they are very simple), but to find a ready-made solution or description of the algorithm on the Internet. I believe that everyone here is smart and will solve these problems in dozens of ways without any mathematics. I was just trying to prove that the lack of knowledge will force you to reinvent the wheel, instead of finding a ready-made algorithm or answer.

    UPD2. Kill yourself


    For those who believe that tasks are sucked out of their fingers:

    If the result of solving your “applied” problems was seen by more people than the solution to this “finger-sucked” task - you can be proud of yourself.

    Also popular now: