/Time-killing-programming-challenges.

Solutions to problems I come across by chance on the internet.

Primary LanguagePython

Time-killing-programming-challenges.

Solutions to random problemes I find on the internet.

  1. Google interview sample question

    Given an array A and a number N, tell whether not there's a matching pair of numbers within A whose sum gives us N.

  2. Make bricks

    We want to make a row of bricks that is goal inches long. We have a number of small bricks (1 inch each) and big bricks (5 inches each). Return True if it is possible to make the goal by choosing from the given bricks. This is a little harder than it looks and can be done WITHOUT loops.

    make_bricks(3, 1, 8) = True

    make_bricks(3, 1, 9) = False

    make_bricks(3, 2, 10) = True

  3. Amazon interview question

    A crack team of love scientists from OkEros (a hot new dating site) have devised a way to represent dating profiles as rectangles on a two-dimensional plane. They need help writing an algorithm to find the intersection of two users' love rectangles. They suspect finding that intersection is the key to a matching algorithm so powerful it will cause an immediate acquisition by Google or Facebook or Obama or something.

    Write a function to find the rectangular intersection of two given love rectangles. As with the example above, love rectangles are always "straight" and never "diagonal." More rigorously: each side is parallel with either the x-axis or the y-axis.