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
Algorithms, Data Structures, Competitive Coding, and problems from LeetCode with complete Solution Approach, Pseudocode, and Explanation.
Linked List is one of the most important data structures and understanding how it works is easier than you think, this post explains the Linked List code in C++. Important Operations on a Linked List As you can see below we use a separate class for Linked List this helps… Read More »Linked List Code in C++
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