## Decrypt String from Alphabet to Integer Mapping Leetcode Solution

Problem Statement In this problem, we are given a string containing digits (0-9) and ‘#’. We have to convert this string to a string of lowercase english letters by using the following mapping. Example s = “10#11#12” “jkab” Explanation: “10#” -> “j” , “11#” -> “k” , “1” -> “a” …

## Rearrange Spaces Between Words Leetcode Solution

Problem Statement In this problem, we are given a text string having some number of words that are placed among the spaces. Words can have only lowercase english letters. Ofcourse each words are separated with at least one space. Also The text has at least one word. e.g. text= ” …

## Hamming Distance Leetcode Solution

Problem Statement In this problem, we are given two integers, A and B, and the goal is to find the hamming distance between the given integers. The integers are greater that/equal to 0 and less than 231    Example First Integer = 5 , Second Integer = 2 3 First Integer …

## Min Stack Leetcode Solution

Problem Statement Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) — Push element x onto stack. pop() — Removes the element on top of the stack. top() — Get the top element. getMin() — Retrieve the minimum element in the stack. …

## Maximum Subarray Leetcode Solution

Problem Statement Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example nums = [-2,1,-3,4,-1,2,1,-5,4] 6 Explanation: [4,-1,2,1] has the largest sum = 6. nums = [-1] -1 Approach 1 (Divide and Conquer) In this approach …

## Sort Array by Increasing Frequency Leetcode Solution

Problem Statement Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasing order. Example nums = [1,1,2,2,2,3] [3,1,1,2,2,2] Explanation: ‘3’ has a frequency of 1, ‘1’ has a frequency of …

## Number of Students Doing Homework at a Given Time Leetcode Solution

The problem Number of Students Doing Homework at a Given Time Leetcode Solution asks us to find the number of students working on their homework at a given time. The problem is very clear, the title itself is already able to explain the whole problem. We are given a query …

## Lucky Numbers in a Matrix Leetcode Solution

The Lucky Numbers in a Matrix Leetcode Solution problem asked us to find a lucky integer from the given matrix. A lucky integer is defined as a number that is the minimum among all other elements in its row and maximum among its column. So there may be more than …

## Largest Substring Between Two Equal Characters Leetcode Solution

The problem Largest Substring Between Two Equal Characters Leetcode Solution, asks us to find the length of the largest substring. Here, a condition is imposed on the substring. The substring should be between the same characters. So, the string must contain at least two equal characters so that the output …

## Build an Array With Stack Operations Leetcode Solution

The Build an Array With Stack Operations Leetcode Solution problem provides us with an integer sequence and an integer n. The problem states that we are given a sequence of integers from 1 to n. Then we use a stack to produce an integer sequence that is given to us …