Valid Parentheses Leetcode Solution

Problem Statement The Valid Parentheses LeetCode Solution – “Valid Parentheses” states that you’re given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’. We need to determine whether the input string is a valid string or not. A string is said to be a valid string if open brackets must be closed …

Read more

Minimum Knight Moves LeetCode Solution

Problem Statement Minimum Knight Moves LeetCode Solution – In an infinite chessboard with coordinates from -infinity to +infinity, you have a knight at square [0, 0]. A knight has 8 possible moves it can make, as illustrated below. Each move is two squares in a cardinal direction, then one square in an orthogonal direction. Return the minimum number …

Read more

Least Number of Unique Integers after K Removals Leetcode Solution

Problem Statement The Least Number of Unique Integers after K Removals LeetCode Solution – “Least Number of Unique Integers after K removals” states that you’re given an array of integers and an integer k. Find the least number of unique integers after removing exactly k elements. Example:   Input: arr = [5,5,4], k = 1 Output: 1 Explanation: Since k …

Read more

Smallest Positive Number Missing in an Unsorted Array

Problem Statement In the given unsorted array find the smallest positive number missing in an unsorted array. A positive integer doesn’t include 0. We can modify the original array if needed. The array may contain positive and negative numbers. Example a. Input array : [3, 4, -1, 0, -2, 2, 1, …

Read more

Translate »