1

Prime number problem

 1 year ago
source link: https://www.techinterview.org/post/3233459742/prime-number-problem-2/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Tech Interview

A site for technical interview questions, brain teasers, puzzles, quizzles (whatever the heck those are) and other things that make you think!

    • 31 Aug 2017

      Prime number problem

      Posted at 11:01 pm by Admin, on August 31, 2017

      You need to a number of floors in a building. There are 68 floors (numbered 1 to 64).

      Conditions:
      1. Can’t buy floors which numbers are prime.
      2. Cannot buy floors which number contains a prime digit.
      3. Can’t buy floor number 1.
      4. Distance between all purchased floors must be different (i.e. you can’t buy floors 4, 6, and 8 because they both have 1 floor between them).
      5. Distance between all purchased floors must be prime.

      Using code or pseudocode figure out:
      1. Maximum number of floors you can buy using conditions 1, 2 and 3?
      2. Maximum number of floors you can buy using all conditions?

Proudly powered by WordPress.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK