We are given a Binary Tree, Print the Right view of Binary tree,
Right view of binary tree is : List of all nodes which are visible If you look at Binary tree from right … Read More
Amazon Interview Question
Find Nearest Minimum number in left side in O(n)
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
Calculate price of parking from parking start end time prices
Given a price rules of parking and start time and end time of parking. Calculate the price
(Below is the table of price rule) Come up with data structure you can store these price rules
Maximum path sum between two leaves
If a binary tree is given, how to find Maximum path sum between two leaves of binary tree.
All should be numbers The maximum sum path may or may not go through root. For example, |
Convert Decimal to Roman numbers / Romanizer HackerEarth Code
Set of Numbers are given to you.
convert them to Roman numbers.
Solution is in Hacker Earth style… Read More
Stock Buy Sell to Maximize Profit
Stock Price on each day is given in an array.
Example : [ 10, 12, 7, 5, 9, 15, 13, 18 ]
Find the max profit that you can make by buying and selling in … Read More
Maximum difference between two elements s.t larger element appears after the smaller number
Find maximum profit if you can buy & sell share just once.
Given an array of integers, find out the difference between any two elements such that larger element appears after the smaller number.
Examples: … Read More
Trie Dictionary
Trie also called prefix tree (as they can be searched by prefixes).
The term trie comes from retrieval.
In the example shown, keys are listed in the nodes and values below them. Each … Read More
‘N’ Story Building, with 1,2,3 steps how many ways can a person reach top of building.
A building has n steps. A person can take 1,2 or 3 steps. In how many ways can a person reach top of building.
In order to build logic, lets think from first step
If … Read More
Top 10 Interviews Techniqes for Campus Interview in IIT NIT BITS for MTech
Couple of years ago when me and my friends appeared for campus interviews in IITs, NITs and BITs we faced many challenging interview questions like N petrol bunks arranged in a city, Sort Stack … Read More