© 2023 Hashnode

#leetcode-solution

If you're struggling with LeetCode problems, algorithms and data structures, or job interview prep, hash maps are a great tool to have in your tool belt. They're fast, flexible, and easy to implement.…

You can find the question here Welcome! In our previous session, we explored various aspects of arrays, including their types, array slicing, and the computational costs associated with array operatio…

Introduction Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If there is no such subarray,…

Problem Link to the LeetCode problem: https://leetcode.com/problems/contains-duplicate/. Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Example 1: In…

You are given a string s, which contains stars *. In one operation, you can: Choose a star in s. Remove the closest non-star character to its left, as well as remove the star itself. Return the st…

Hey, so today we are going to solve Leetcode - Maximum Length of Pair Chain Problem Link- https://leetcode.com/problems/pair-chain class Solution { public: int findLongestChain(vector<vector<int>>…

Hey, so today we are going to solve Leetcode - Longest Increasing Subsequence Problem Link- https://leetcode.com/problems/longest-increasing-subsequence class Solution { public: int lengthOfLIS…

59. Spiral Matrix II In the very last question, we have done a question where we have to print a 2D matrix in spiral form and in this question, we have to insert values into that 2D matrix from i to n^2. The approach for this problem would …

54. Spiral Matrix Given an m x n matrix, return all elements of the matrix in spiral order. In this question, we will use four indices startrow=0, startcol=0, endrow=n-1, and endcol=m-1. vector<int> spiralOrder(vector<vector<int>>& matrix)…

Introduction In this post, I will discuss how to determine if a given string of parentheses is valid or not using different programming languages. Problem Statement The problem is to check if a string…