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
[1]
by Dhaval Dave
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.