Facebook | Phone Screen | Randomly Place Mines

Position: Production Engineer
Result: Rejection

Question 1:
Write a function which accepts size of a grid n * m and no. of mines and places mines on the grid randomly.

Question 2:
A critical network service is being upgraded. The developers have decided to use a new port to reduce confusion. The migration will take a long time so a daily report of the migration's process is needed. Write a script that will take in a list of hosts on STDIN, one per line, and a pair of ports as command-line parameters. Your program should print the progress of the migration and have special output for hosts that are running both versions, and hosts that aren't running any version or are down.

example of execution
cat host.list | myscript oldport newport

Comments (4)