Pramp came across my Product Hunt daily email and I decided to check it out.

Pair programming to practice interview questions for free. Check it out! It may be worth your time and the practice.

2 Likes

Have you tried it yet?

No. I have not. Not ready for that yet. Just thought Iâ€™d share. Seems decent enough. Potential problems have been brought up on their Product Hunt entry. Worth a shot anyways, imho.

Ok, I am going to try an interview next week (5 Sept)!

The interview questionâ€¦

Given a 2D array binaryMatrix of 0s and 1s, implement a function getNumberOfIslands that returns the number of islands of 1s in binaryMatrix.

An island is defined as a group of adjacent values that are all 1s. A cell in binaryMatrix is considered adjacent to another cell if they are next to each either on the same row or column. Note that two values of 1 are not part of the same island if theyâ€™re sharing only a mutual â€ścornerâ€ť (i.e. they are diagonally neighbors).

Explain and code the most efficient solution possible and analyze its time and space complexities.

I think I would be on the bus home if I got this in an interview.

Tips:
If your peer is stuck, ask them if they know how to traverse a undirected graph.
At this point, you peer may come up with a recursive solution by using a Breadth-First Search (BFS) or a Depth-First Search (DFS) algorithm. While this works, see if you can nudge them toward an iterative solution. This is not a must, but preferable.
Make sure that your peerâ€™s code does not access out of bound indices, especially when trying to traverse adjacent cells in binaryMatrix.
Watch out for duplicate island counting in your peerâ€™s code. Itâ€™s important that a visited cell of 1 is marked properly to avoid redundant counting.
Any solution that takes more than O(Nâ‹…M) time isnâ€™t optimal.

1 Like

I think the idea here is to give you a question you canâ€™t do to see how you cope under pressure.

Not sure if you have tried it yet, but itâ€™s a great platform to get used to doing online practice Interviews. I would suggest check it out if you are practicing for your interviews since they pair you with other developers to practice. Also, they have just released a new option to practice with a friends.