Maximum Score From Removing SubstringsProblem Link https://leetcode.com/problems/maximum-score-from-removing-substrings/description/ Approach If x > y we have to focus on making the "ab" pairs more than any other pair, so we will do the same in the first pass Once all the pairs are don...Jul 12, 2024·2 min read
Water bottle Problem (Leetcode POTD)Problem Link Click Here Approach We need to calculate the maximum number of full water bottles we can consume right so let's consider one test case Total filled bottled = 15, Exchange Rate = 4 So initially we will consume 15 bottles now these bott...Jul 7, 2024·1 min read
Two sum problem (The foundation)NOTE - please read this article properly and solve the question twice once on paper and then on leetcode because this question serves as the foundation for the upcoming question In this category that is, 3 sum and 4 sum Question Click Here Approaches...Jul 6, 2024·2 min read
Slow and Fast AlgorithmThe Use-Case This algorithm is used in various cases and concepts when it comes to linked list, some use cases are as follows For finding the mid of the linked list in O(n) complexity. To Detect the loop in the linked list now let's discuss it's ...Jul 5, 2024·3 min read
Moore's Voting AlgorithmWorking Let the initial length be 1, because we are considering the first element as the initial element in our count. Move forward in the array and if the same element appears again, then increase the count by 1; if not, then decrease the count by...Jul 4, 2024·2 min read
Rotate the array by K placesQuestion link - https://leetcode.com/problems/rotate-array/ Approach 1 Brute Force approach Create a temporary vector that will store the number of arrays present to be rotated. Now we need to normalize the rotation because for example if the size ...Jul 3, 2024·2 min read