Search a 2D Matrix II Leetcode Solution

Problem Statement The Search a 2D Matrix II LeetCode Solution – “Search a 2D Matrix II”asks you to find an efficient algorithm that searches for a value target in an m x n integer matrix matrix. Integers in each row, as well as column, are sorted in ascending order. Example: Input: matrix = [[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16,22],[10,13,14,17,24],[18,21,23,26,30]], target = 5 Output: true …

Read more

Maximum Length of a Concatenated String with Unique Characters Leetcode Solution

Problem Statement The Maximum Length of a Concatenated String with Unique Characters LeetCode Solution – “Maximum Length of a Concatenated String with Unique Characters” says that you’re given an array of strings and you need to choose any subsequence of the given array and concatenate those strings to form the …

Read more

Shortest Word Distance Leetcode Solution

Problem Statement The Shortest Word Distance LeetCode Solution – says that you’re given an array of strings and two different words. We need to return the shortest distance between these two words that appear in the input string. Example: Input: wordsDict = [“practice”, “makes”, “perfect”, “coding”, “makes”], word1 = “coding”, word2 = “practice” Output: 3 Explanation: Word “coding” occurs at position 4. …

Read more

Set Matrix Zeroes Leetcode Solution

Problem Statement The Set Matrix Zeroes LeetCode Solution – “Set Matrix Zeroes” states that you’re given an m x n integer matrix matrix.We need to modify the input matrix such that if any cell contains the element  0, then set its entire row and column to 0‘s. You must do it in …

Read more

Missing Number Leetcode Solution

Problem Statement The Missing Number LeetCode Solution – “Missing Number” states that given an array of size n containing n distinct numbers between [0,n]. We need to return the number which is missing in the range. Example:   Input:  nums = [3,0,1] Output: 2 Explanation: We can easily observe that all the …

Read more

Design a Stack With Increment Operation Leetcode Solution

Problem Statement The Design a Stack With Increment Operation Leetcode Solution –  states that we need to design a stack that supports the below operations efficiently. Assign the maximum capacity of the stack. Perform the push operation efficiently, if the size of the stack is strictly less than the maximum capacity of …

Read more

Translate »