Medium Top Interview set 2 Flashcards
1
Q
Tic Tac Toe
A
Create board. For every move, check row, col and diagonals. Both diagonals.
2
Q
- Kth Smallest element in a sorted matrix
A
Use a heap, pop the smallest and push its neighbours.
3
Q
384 Shuffle an array
A
Generate random number j from n to 0 and keep shuffling
4
Q
Kth Largest element in an array
A
heapify
5
Q
Group anagrams
A
dictionary of sorted strings
6
Q
62 unique paths
A
Dynamic programming
7
Q
- Container with most water
A
Two pointer approach from extreme ends
8
Q
380 Insert delete getrandom
A
Keep a list and a dictionary