Word Search : Given a 2D board and a word, search if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell,
where “adjacent” cells are those horizontally … Read More
2d matrix
Facebook Interview Question : Interleave List
Interleave List If input = [[1,2,3], [9, 0], [5], [-4,-5,-2,-3,-1]] then output = [1,9,5,-4,2,0,-5,3,-2,-3,-1];
Asked in Facebook F2F… Read More
Number of Islands BFS/DFS
Problem Statement:
Given a 2d grid containing either values either 0 or 1 where 1 represents land and 0 represents water. You have to calculate the number of total islands in the given grid. An … Read More
Coin Collection Dynamic Programming
Problem Statement:Coin Collection Dynamic Programming
Given a rectangular grid where each cell contains some coins. You are at the first row and you want to go to the last row with the objective of collecting … Read More
Skiing on Mountains Matrix
Skiing on Mountains Matrix : “John Snow” likes Skiing on Mountains a lot.That’s not very surprising, since skiing is really great. The problem with skiing is one have to slide downwards to gain speed. Also … Read More
Search element in a matrix with all rows and columns in sorted order
And You have to search an element output its location row,column number .
If no such element the just
TicTacToe Game As Asked in Flipkart
Decide which basic functions which would be required to implement the same.
robot standing at first cell of an M*N matrix. It can move only in two directions, right and down. In how many ways, it can reach to the last cell i.e. (M, N) Code it
Robot standing at first cell of an M*N matrix. It can move only in two directions, right and down. In how many ways, it can reach to the last cell i.e. (M, N) Code it.
Printing Longest Common Subsequence
Printing Longest Common Subsequence
Given two sequences, print the longest subsequence present in both of them.
Examples:
LCS for input Sequences “ABCDGH” and “AEDFHR” is “ADH” of length 3.
LCS for input Sequences “AGGTAB” and