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
Fibonacci Hashing & Fastest Hashtable
Fibonacci Hashing : How do we find out what this Fibonacci Hashing is?
In real world Fibonacci hashing is not implemented or used even a part of it, because it’s actually more (Time and Space) … Read More
Hackerearth : Counting Subarrays
Given an array A of N positive integer values. A sub-array of this array is called Odd-Even sub-array if the number of odd integers in this sub-array is equal to the number of even integers … Read More
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
Serialise Deserialise N-ary Tree
Serialise Deserialise N-ary Tree : N-ary tree’s each node contains at-most N children. Serialise the tree means storing the tree in array or file maintaining tree’s exact structure. On the other hand Deserialise the tree … 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
Find shortest distances between every pair of vertices ( Dynamic Programming Floyd Warshall Algorithm)
Find shortest distances between every pair of vertices in a given edge weighted directed Graph.
Input:
The first line of input contains an integer T denoting the no of test cases . Then T test … Read More
Diagonal Traversal of Binary Tree
Given a Binary Tree, print the diagonal traversal of the binary tree
Consider lines of slope -1 passing between nodes. Given a Binary Tree, print all diagonal elements in a binary tree belonging to same … Read More
Printing intermediate Integers between one element & next element of array
Problem : Printing intermediate Integers
User entered numbers are set into array.Intermediate integer of each pair of successive elements to be printed.
Input :
Input of 1st line is number of element in array,inputs of … 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