Missing Number LeetCode, from the given array we have to find the missing numbers and we were asked to solve this with O(1) extra space complexity i.e constant space and O(n) runtime complexity. This means that we should not use extra space, it should be constant.
Today I came across a problem where I was asked to remove duplicates from an array and print them, it was an easy problem but the array was not sorted. Usually, we can solve it with two loops but I wanted to do it efficiently in just one iteration. Iterate… Read More »Remove Duplicates from an Unsorted Array
The Queue is one of the most important Linear Data Structure, Queue program follows the FIFO rule i.e First In First Out. The contents in a queue exit in the same order they have entered, if an element is to be removed from the queue then the first element that… Read More »Queue program in C++ using Array and STL
LeetCode Contains Duplicate problem, to check if the given array contains duplicates or not, if yes return True else return False Asked in: Google Difficulty: Easy Description This is an easy problem and can be solved in one iteration as we start from the beginning if we find any number… Read More »Contains Duplicate LeetCode C++
I was brushing up my data structure skills and this post contains code for the Stack program using both Array and STL containers, the Stack follows the LIFO mechanism i.e Last In First Out, the element that was inserted last will also be the first to be deleted like a… Read More »Stack Program in C++ using Array and STL