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) =
Interview Questions asked in Google, Microsoft, Amazon
by Dhaval Dave
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) =
by Dhaval Dave
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
by Dhaval Dave
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
by Dhaval Dave
strtok() : Split string into tokens
Syntax :
char * strtok ( char * str, const char * delimiters );
Parameters
str C string to truncate.Notice that this string is modified by being broken into … Read More
by Dhaval Dave
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
by Dhaval Dave
In a linked list, the items are linked together through a single next pointer.
In a binary tree, each node can have 0, 1 or 2 subnodes, where (in case of a … Read More
by Dhaval Dave
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
by Dhaval Dave
by Dhaval Dave
by Dhaval Dave
Given a sorted array and a number x, find a pair in array whose sum is closest to x.
Examples:
Input: arr[] = {10, 22, 28, 29, 32, 40}, x = 54
Output: 22 and