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
by Dhaval Dave
example
by Dhaval Dave
by Dhaval Dave
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
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,