Pregunta de entrevista de Netflix

How would you translate input string into sequence of movements through on screen keyboard? What if you can loop through rows and columns?

Respuestas de entrevistas

Anónimo

23 de feb de 2016

Keep in mind that using matrix will leave you with quadratic running time. Using looping rows and columns will make algorithm slightly more complex, just have to decide which direction is it faster to move. Quite interesting optimal path question overall.

1

Anónimo

29 de feb de 2016

So if I'm understanding correctly, you're given a string (e.g. "Star Wars") and an on-screen keyboard accessible through an up-down-left-right controller. The goal is to be able to convert a given string into a sequence of UDLR commands that will enter that string through the keyboard. What if you pre-calculated a map of the optimal path between any two keys? Store it in a hashmap where the key is "current_position+desired_position" (e.g. from "Star Wars", you would have entries for "S+t", "t+a", "a+r", etc.) and the value is a sequence of U+D+L+R indicating the cursor moves. You could even get clever and store it as some kind of routing table, similar to what is used for internet routers. Think of each letter on the keyboard as a router that has a route to each of its neighbors in the UDLR directions. Then, inject a dictionary of strings into the network based on movie titles, actor names, etc. from each "endpoint" and let it learn the most efficient way to enter each of them. This way, when you go to internationalize or change keyboard layouts, you can re-create an efficient map automatically.

9

Anónimo

23 de ene de 2021

It's essential to demonstrate that you can really go deep... there are plenty of followup questions and (sometimes tangential) angles to explore. There's a lot of Senior Software Engineer In Test experts who've worked at Netflix, who provide this sort of practice through mock interviews. There's a whole list of them curated on Prepfully. prepfully.com/practice-interviews