Given an array of integers, find the nearest smaller number for every element such that the smaller element is on left side.

Examples:

Input: arr[] = {1, 6, 4, 10, 2, 5} Output: {-1, 1,… Read More

Interview Questions asked in Google, Microsoft, Amazon

by Dhaval Dave

Given an array of integers, find the nearest smaller number for every element such that the smaller element is on left side.

Examples:

Input: arr[] = {1, 6, 4, 10, 2, 5} Output: {-1, 1,… Read More

by Dhaval Dave

Here We have implemented a Generic Stack Example with Templates in C++ where we can Push any element into stack.

#include <iostream>

#include <vector>

#include <cstdlib>

#include <string>

#include <stdexcept>

using namespace std;… Read More

by Dhaval Dave

Write a function to print spiral order traversal of a tree or Write function for Tree traversal in Spiral ZigZag form

For below tree, function should print 1, 2, 3, 7, 6, 5, 4.

For below tree, function should print 1, 2, 3, 7, 6, 5, 4.

[1]

by Dhaval Dave

Generally Interviewer can ask you simply to implement LRU cache, first explain which data structure you will use and why.

Its well known coding question being asked by all Tech giants like Amazon , Flipkart,

by Dhaval Dave

Question : Get Minimum element in O(1) from Input Numbers or Stack

– With any traditional way we can’t get minimum element in O(1)

– so we need to come up with different data structure.