Whiteboard coding exercise (trivia from the Jeopardy "Graph category"): - write code for a 3-letter "word ladder" to find the length of the shortest sequence to get from "hit" to "cog" (if there is a valid sequence) where only one letter in the word can be changed with each step through the words in the "set". start = "hit" end = "cog" set = ["hot","dot","dog","lot","log"] expected path: hit -> hot -> dot -> dog -> log -> cog
Anonymous
Zero correlation to the job description and obviously ability to solve this question reasonably is based on a person's experience with graphs - which is literally of zero use for this job. Their answer is to construct a graph linking the whole words. Find the graph connections by creating permutations of each word: for each letter in a word, cycle through a-z and look for matches. Perform BFS on the graph and track the possible path lengths. Sounds easier than it is, unless you're familiar with graphs.
Check out your Company Bowl for anonymous work chats.