Facebook SW Internship onsite interview

My interview was conducted on my campus. he recuiter didn't ask any behavioral questions. The coding questions were:

  1. Given a string, tell me if there is a permutation that is a palindrome.
    for example: aab ->true
    ab ->false
    For this problem, I used a dictionary (although after the interview I realized that an int array was better) were I stored the frecuency of each character of the string. If more than one character had an odd frecuency i returned false, otherwise, true.

  2. Given a list of tasks, and a cooling time that has to be waited before repeting a task, tell me the minimum seconds a machine needs to run all the tasks. Every task is executed in 1 second.

for example:

list: [A,A,B,A] , cooling time: 2 seconds --> 7

task A needs one second. Then the machine needs to wait 2 seconds before executing A again, so it needs 3 seconds before executing the second task. Then it executes task A in 1 second. Then B in 1 second. And finally, before executing the last task it need to wait 1 second, and then A is executed in 1 second.

Today I recieved an email saying that I passed that interview

Comments (2)