Output : 4Method 1 : in O(n) we can do it .

## Given array of 0’s and 1’s. All 0’s are coming first followed by 1’s. find the position of first 1

Output : 4Method 1 : in O(n) we can do it .

Interview Questions asked in Google, Microsoft, Amazon

by Dhaval Dave

Given array of 0’s and 1’s. All 0’s are coming first followed by 1’s. find the position of first 1

Example : 00001111

Output : 4Method 1 : in O(n) we can do it .

… Read More Output : 4Method 1 : in O(n) we can do it .

by Dhaval Dave

A template is a blueprint or formula for creating a generic class or a function. The library containers like iterators and algorithms are examples of generic programming and have been developed using template concept.

… Read More example

by Dhaval Dave

Danny has a possible list of passwords of Manny’s facebook account. All passwords length is odd. But Danny knows that Manny is a big fan of palindromes. So, his password and reverse of his password

… Read More by Dhaval Dave

Given a linked list, write a function to reverse every k nodes (where k is an input to the function).

… Read More Example:

Inputs: 1->2->3->4->5->6->7->8->NULL and k = 3

Output: 3->2->1->6->5->4->8->7->NULL.

Solution : Reverse a LinkedList keeping

by Dhaval Dave

Several Companies like MS, Amazon and Flipkart has started asking this question to Generate next palindrome number.

Say K is given, Generate N such that N is palindrome and N > K.

Logic 1) Create

by Dhaval Dave

Generally Interviewer can ask you simply to implement LRU cache, first explain which data structure you will use and why.

Its well known coding question being asked by all Tech giants like Amazon , Flipkart,

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.

by Dhaval Dave

by Dhaval Dave

Design an algorithm such that we have to find the k th element in the array such that their only prime factors are 3,5

by Dhaval Dave

Input: In-order traversal in[] = {4, 2, 5, 1, 3, 6} Pre-order traversal pre[] = {1, 2, 4, 5, 3,