## 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= ” …

## 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 …

## 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 …

## Maximum Score After Splitting a String Leetcode Solution

The problem Maximum Score After Splitting a String Leetcode Solution provided us with a string. The given string contains only 0 and 1. So one can also consider it as a binary sequence. The problem then asked us to find the maximum score achievable after splitting the string. After splitting …

## Excel Sheet Column Title Leetcode Solution

Problem Statement In this problem a positive integer is given which represents a column number of an Excel sheet, we have to return its corresponding column title as appear in an Excel sheet. Example #1 28 “AB” #2 701 “ZY” Approach This problem is the reverse of the problem in …

## Number of Steps to Reduce a Number to Zero Leetcode Solution

The problem Number of Steps to Reduce a Number to Zero Leetcode Solution states that given an integer. Find the minimum number of steps to convert the given integer to 0. You can perform either of the two steps, either subtract 1 or divide the integer by 2. The problem …

## Rank Transform of an Array Leetcode Solution

The problem Rank Transform of an Array Leetcode Solution provided us with an array of integers. The array or the given sequence is unsorted. We need to assign ranks to each integer in the given sequence. There are some restriction s for assigning the ranks. The ranks must start with …

## Decompress Run-Length Encoded List Leetcode Solution

The problem Decompress Run-Length Encoded List Leetcode Solution states that you are given an array or vector containing a sequence. The sequence has some specific representation. The input sequence is formed from another sequence. We will call that another sequence as the original sequence. As per which the input sequence …

## Minimum Distance Between BST Nodes Leetcode Solution

The problem Minimum Distance Between BST Nodes Leetcode Solution states that you are provided with a Binary Search Tree. And you are required to find the minimum difference in the entire BST. So, you need to find the minimum absolute difference between any two nodes in the BST. A BST …

## Combinations Leetcode Solution

The problem Combinations Leetcode Solution provides us with two integers, n, and k. We are told to generate all the sequences that have k elements picked out of n elements from 1 to n. We return these sequences as an array. Let us go through a few examples to get …