New Coding Interview Practice for Free

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.


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)! :smile:

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.:frowning_face:

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.