All Questions
Tagged with depth-first-search interview-questions
8 questions
2
votes
0
answers
74
views
LeetCode: Number of enclaves C#
https://leetcode.com/problems/number-of-enclaves/
Given a 2D array A, each cell is 0 (representing sea) or 1 (representing land)
A move consists of walking from one land square 4-directionally to ...
2
votes
2
answers
261
views
Ruby implementation for Hacker Rank connected cells in a grid
https://www.hackerrank.com/challenges/connected-cell-in-a-grid/problem
problem statement:
Consider a matrix where each cell contains either a 1 or a 0. Any
cell containing a 1 is called a ...
5
votes
1
answer
6k
views
Sudoku solver recursive solution with clear structure
Problem statement
Similar to Leetcode 37 Sudoku solver, the algorithm is to determine if the sudoku board can be filled with ‘1’,‘2’,…,‘9’.
A sudoku board is represented as a two-dimensional 9x9 ...
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 ...
8
votes
2
answers
9k
views
C++ Graph Class Implementation (adjacency list)
I've got a barebones C++ graph class implemented as an adjacency list. The graph consists of a vector of vertices. Each vertex has a vector of outgoing edges that store the destination vertex id. ...
6
votes
1
answer
122
views
Find the largest continuous descending sum in a 2d matrix
Given a 2d array, the problem is to find the largest sum, where each subsequent is >= the previous digit but < all of the 'neighbour' digits. You can only move up, down, left and right.
My ...
5
votes
3
answers
22k
views
Graph Creation and BFS + DFS in C#
I was asked to implement a graph and BFS and DFS.
Please comment. Is it understandable? Is my algorithm correct? Are there any optimizations?
...
6
votes
3
answers
2k
views
Missing level of technical depth (Flatten Tree)
I recently have given a coding test in a reputable IT company. There were three coding questions.
They refused me by saying that
as we felt they didn't demonstrate the level of technical depth we'...