#What did they ask?
1 messages · Page 1 of 1 (latest)
say the problem
Can you solve this real interview question? Minimum Distance to Type a Word Using Two Fingers - [https://assets.leetcode.com/uploads/2020/01/02/leetcode_keyboard.png]
You have a keyboard layout as shown above in the X-Y plane, where each English uppercase letter is located at some coordinate.
- For example, the letter 'A' is located at coordi...
however instead of typing a word you wanted to find the min distance between restaurants
and the 2d matrix could be filled with any amount of restaurants upto n^2
restriction was to O(n^2) for time complexity
đź’€
at the end you want to return the starting point with that min dist
horrible interviewer to ask that
and apparently you can have more than 1 starting point with a min dist, which i didn't fully understand but 🤷‍♂️
yeah idk, i tried my best
Wouldn’t that be mst on the weighted graph with only those restaurants being nodes
10/03
there could potentially be other non-restaurants in the matrix, like stores and etc
prob b/c of my exp
what do u mean due to ur exp?
Yeah you’d have to precompute the graph first with some math bs
But I think ignoring the non restaurants probably doesn’t change stuff right
yeah, i don’t exactly recall but I believe if there were no restaurants then you’d do the min dist between all those non restaurants
that wasn’t included in the prompt though, it was an edge case that he gave me
min dist was found using manhattan distance formula and he did tell I was allowed to modify the graph before
Right so if u have all the restaurant coordinates you could find the edge weight between each pair
And then stick this on it
Kruskal’s Minimal Spanning Tree - Kruskal’s minimal spanning tree algorithm is one of the efficient methods to find the minimum spanning tree of a graph. A minimum spanning tree is a subgraph that connects all the vertices present in the main graph with the least possible edges and minimum cost (sum of the weights assigned to each
It would be n^2 bc you have to get all the edge weights
yeah i was not thinking of kruskal’s during the interview 💀
i should’ve asked if I could look stuff up
That’s wild tho Idt I’ve gotten anything like this in an interview
which is?
.
lmao i TA dsa and prev at amazon. got fucking kokobananas and binary search a sorted list
Probably no hc so instead of cancelling just gave an impossible interview
im sorry
this makes the most sense
kokos bananas is my arch nemisis ong
i also got koko and some binary search lmao