Medium Top Interview set 2 Flashcards

1
Q

Tic Tac Toe

A

Create board. For every move, check row, col and diagonals. Both diagonals.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. Kth Smallest element in a sorted matrix
A

Use a heap, pop the smallest and push its neighbours.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

384 Shuffle an array

A

Generate random number j from n to 0 and keep shuffling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Kth Largest element in an array

A

heapify

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Group anagrams

A

dictionary of sorted strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

62 unique paths

A

Dynamic programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. Container with most water
A

Two pointer approach from extreme ends

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

380 Insert delete getrandom

A

Keep a list and a dictionary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly