LeetCode

Count Vowels in a String with JavaScript

Problem Statement: For any given string write JavaScript code to console log the count of vowels with separate counts for each vowel occurrence. e.g if enter the string “apple” the output should be vowel count:: a:1, e:1, i:0, o:0, u:0. Let’s try to do this in a single iteration i.e.… Read More »Count Vowels in a String with JavaScript

#30DaysofCode

• DSA

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

Count the Duplicates of Array O(N)

• DSA

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)

• DSA

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

Squares of a Sorted Array LeetCode O(N)

• DSA

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)

Find Missing Number in Array LeetCode

• DSA

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.