I had started the #30DaysofCode📚 challenge while I was revising the basic concepts, data structures, and solving easy problems on LeetCode. I documented this so that it helps both me and others to recall what we have learned. How to use this list📑 First, look at the given questions, if… Read More »#30DaysofCode
In the given problem, we have a sorted array, and we need to count the duplicates of each element. In simple words, we should print the no.of times each element occurs. Example Solution approach Since we have a sorted array, things become much easier. Once we traverse through an element,… Read More »Count the Duplicates of Array O(N)
Yes, we are doing it today. The all-time famous interview question, Do you know how to reverse a Linked List? Well turns out, it isn’t that difficult and it’s all about logic and pointers, okay let’s get started. Alright, I already wrote a post explaining the basic operations and structure… Read More »Reverse a Linked List
In this problem, given a sorted array in decreasing order and we should return the squares of each number and in the same ascending order, and the one thing we need to take care of is that the negative numbers, which when squared disturb the ascending ordered array. Problem Statement… Read More »Squares of a Sorted Array LeetCode O(N)
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.