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
A class is made abstract by declaring at least one of its functions
by Dhaval Dave
Polymorphism occurs when there is a hierarchy of classes and they are related by inheritance.
C++ polymorphism means that a call to a member function will cause a different function to
by Dhaval Dave
Data abstraction refers to, providing only essential information to the outside world and hiding their background details
Any C++ program where you implement a class with public
by Dhaval Dave
by Dhaval Dave
[1] / \ [2] [3] / \ / \ [4] [5] [9] [10] / / \ [8] [6] [7]
say
by Dhaval Dave
by Dhaval Dave
Given a Binary Tree and a positive integer k, print all nodes that are distance k from a leaf node.
Here the meaning of distance k from a leaf means k levels higher than a
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