All Questions
5 questions
2
votes
1
answer
5k
views
Pattern searching in 2d grid
This is an interview question which i am trying to solve.
You are given a 2D array of characters and a character pattern. WAP to find if pattern is present in 2D array. Pattern can be in any way (all ...
1
vote
2
answers
12k
views
Rotate matrix 90 degrees clockwise
Please suggest improvements and a possible better way of doing it in place.
...
7
votes
3
answers
5k
views
Searching in a sorted 2D matrix
If I was at an interview, and wrote this code, what would you think? Please be brutal.
Time it took to wrote it: 13 minutes
Problem:
Write an efficient algorithm that searches for a value in an m x n
...
13
votes
5
answers
10k
views
Set matrix zeros
I solved this problem in about 11 minutes (with all 50+ test cases passed).
I think most of you already know me by now, and I truly appreciate your advice, but please be brutal and judge me as if I ...
4
votes
1
answer
8k
views
Clockwise and counterclockwise spiral matrix traversal
An interviewer asked me to write clean Java code for clockwise and counterclockwise spiral matrix traversal.
e.g. {{1,2,3}, {7,8,9}} becomes ...