Had an FB phone interview today for an E3 position. Was asked a couple of questions - Solved one and bombed the other.
Question 1. Check if a valid anagram exists for a String in a given list of words
Explained two approaches - Wrote code for 2nd approach with O(1) space and O(length of String X list length )
Question 2.
Given a word of length n and n Blocks of characters where each block has 6 sides, return the list of blocks in the order they should be arranged to get the word. (Ignore rotation of the block)
Example:
Input:
word = "hello"
dice = [[a, l, c, d, e, f], [a, b, c, d, e, f], [a, b, c, h, e, f], [a, b, c, d, o, f], [a, b, c, l, e, f]]
Output: dice[2] + dice[1] + dice[0] + dice[4] + dice[3]
The wording for this question threw me off. Would have probably been easier to understand if "block of chars" was just mentioned as a dice. I made a few blunders(made assumptions on the question) jumping into this problem and it took me almost 10-12 minutes to just to clarify and understand. I had about 20+ mins for this problem because I finished the first question quickly. Wasnt able to give an approach since I took the entire time to just understand what was being asked. Looking back at the problem now, I feel would have atleast given a couple of approaches but this was a completely new problem to me and I spent too long on just figuring out the question.
EDIT: YOE 2.5 yrs