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
Hacker Earth Questions
Trapping Rain Water
Trapping Rain Water or Water collected between towers : Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after … Read More
Handle duplicates in Binary Search Tree
In a Binary Search Tree (BST), all keys in left subtree of a key must be smaller and all keys in right subtree must be greater. So a Binary Search Tree by definition has distinct … Read More
Minimum insertions to form a palindrome
Given a string, find the minimum number of characters to be inserted to form Palindrome string out of given string
Before we go further, let us understand with few examples:
ab: Number of insertions required … Read More
Urban Ladder Written Test.
I have given Urban Ladder Online Test and my experience and questions are as below.
MCQ ROUND
Q1) An implementation of a queue Q, using two stacks S1 and S2, is given below:… Read More
Convert number to words java
Write a code to Convert number to words . example ip 15 op : fifteen
ip : 1234 op : one thousand and thirty four
Algorithm : When we detect a number at any place … Read More
FizzBuzz Solution C C++
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples … Read More
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
Print Power Set of a Set
Print Power Set of a Set of character.
Power Set Power set P(S) of a set S is the set of all subsets of S. For example S = {a, b, c} then P(s) =
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