Count Possible Decodings of a given Digit Sequence
Find number of ways a string can be decoded into, if A=1, B=2, C=3 … Z=25 and encoding number is 123 ways decoding can be done is
1 2 3 = A B C
1
… Read More 1 2 3 = A B C
1
Find the element that appears once others appears thrice
Given an array where every element occurs three times, except one element which occurs only once. Find the element that occurs once.
Expected time complexity is O(n) and O(1) extra space.
Examples:
Input: arr[] =
… Read More Expected time complexity is O(n) and O(1) extra space.
Examples:
Input: arr[] =
VMWare Openings
One of My Friend gave Interview for VMWare,
Those who are interested, can Apply
——————————————————————————
PS : Premium Institute And Java Experienced Person.
——————————————————————————
… Read More Those who are interested, can Apply
——————————————————————————
PS : Premium Institute And Java Experienced Person.
——————————————————————————
Find the smallest window in a string containing all characters of another string
Given two strings string1 and string2, find the smallest substring in string1 containing all characters of string2 efficiently.For Example:
Input string1: “this is a test string”
Input string2: “tist”
Output string: “t stri”
Find if a binary tree is height balanced ?
A Height Balanced Tree is tree where for each node this condition is true.
– The difference between heights of left subtree and right subtree for any node is not more than 1.So we can
… Read More – The difference between heights of left subtree and right subtree for any node is not more than 1.So we can
Check if an array has duplicate numbers in O(n) time and O(1) space
We have array a[ ]= {1, 2, 3, 4, 5, 6, 7, 8, 4, 10};
And we need to find a number which is duplicate in O(n) and Space complexity O(1)
Method 1 ) Sorting
Find the number ABCD such that when multipled by 4 gives DCBA.
We need to find a number ABCD such that, 4(ABCD) = DCBA
These problems can be tricky and/or tedious, but this one isn’t too bad.Method 1 ) Forming Equations and Solving them
… Read More These problems can be tricky and/or tedious, but this one isn’t too bad.Method 1 ) Forming Equations and Solving them
Word Break Problem
Given an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words. See following examples for more details.
This is a famous
… Read More This is a famous
Puzzle : 100 doors in a row Visit and Toggle the door. What state the door will be after nth pass ?
you have 100 doors in a row that are all initially closed. you make 100 passes by the doors starting with the first door every time. the first time through you visit every door and
… Read More