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 readujjwalsharma.hashnode.dev
Reverse Substrings Between Each Pair of ParenthesesProblem Link Click Here Approach First we will store the characters other than parenthesis because we don't want parenthesis in our answer. As soon as we encounter an opening bracket we will store it's index In the vector As all the parenthesis ar...Jul 11, 2024 · 1 min readujjwalsharma.hashnode.dev
Crawler Log Folder (LeetCode)Problem Link Click Here Intuition see whenever we write the commandcd /foldernameand suppose you are in the root directory so once this command is executed, how many steps you need to go back to root directory? 1 step right you will just peform cd .....Jul 10, 2024 · 2 min readujjwalsharma.hashnode.dev
Average Waiting time (Simulation based question)Problem link Click here Approach Initially, when the chef is not doing anything and a customer arrives, the waiting time for the customer to get a particular dish ordered is nothing but just the preparation time. Now, let's suppose the chef is prep...Jul 9, 2024 · 2 min readujjwalsharma.hashnode.dev
Josephus AlgorithmProblem Link Click Here Approaches Approach 1 (Brute force) we will create one array/vector to store the values from 1 to n, representing the sequence of each person As given in the question we will remove one person from the array and move forward...Jul 8, 2024 · 1 min readujjwalsharma.hashnode.dev