LeetSolve - Level Up Your Coding Skills
Archives
Search
Subscribe
Leetcode 448. Find All Numbers Disappeared in an Array
June 10, 2024
Problem statement You are given an array nums of n integers, where each integer nums[i] falls within the range [1, n]. Your task is to find and return an...
Leetcode 59. How To Go Around A Square Matrix In Spiral Order
January 21, 2024
Problem statement Given a positive integer n, generate an n x n matrix filled with elements from 1 to n^2 in spiral order. Example 1 Input: n = 3 Output:...
Leetcode 120. How To Find The Minimum Path From Top To Bottom Of A Triangle
January 21, 2024
Problem statement You're provided with a triangle array. Your goal is to find the smallest possible sum of a path from the top of the triangle to the bottom....
Leetcode 3. How To Find The Longest Substring Without Repeating Characters
January 3, 2024
Problem statement Given a string s, your task is to determine the length of the longest substring within s that does not contain any repeating characters....
Leetcode 342. How to Check If a Number is a Power of Four
December 1, 2023
The math and the bit behind a power of four.
Leetcode 1695. How To Find The Maximal Subarray Having Distinct Elements
November 30, 2023
Problem statement You have an array of positive integers called nums, and you wish to remove a subarray from it that consists of distinct elements. The score...
Leetcode 63. How To Count Unique Paths In A Grid With Obstacles
November 27, 2023
Problem statement You're given an m x n grid represented as an integer array called grid. In this grid, there is a robot initially located at the top-left...
Leetcode 2. How To Add Two Numbers Represented As Linked Lists
November 27, 2023
Problem statement You have two linked lists that represent non-negative integers. The digits of these numbers are stored in reverse order, with each node...
Leetcode 804. How to Encode Morse Code
November 15, 2023
Problem statement The problem involves the International Morse Code, which defines a standard way to encode letters with dots and dashes. Each English letter...
Leetcode 387. How to Perform a Counting Using Array and Hash Table
November 15, 2023
Problem statement You have a string called s. Your objective is to locate the index of the first character in the string that does not repeat anywhere else...
Leetcode 13. How to Convert a Given Roman Numeral to its Equivalent Integer Value
November 15, 2023
Problem statement Roman numerals utilize seven symbols: I, V, X, L, C, D, and M to represent numbers. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For...
Leetcode 235. How To Find a Nearest Common Ancestor In a Binary Search Tree
November 13, 2023
Problem statement Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According to the definition of...
Leetcode 729. How to Define a Custom Comparison For a std::set
November 13, 2023
Problem statement You're creating a program to use as your calendar. You can add new events to the calendar, but only if adding the event will not lead to a...
Leetcode 378. How To Find The Kth Smallest Element in a Sorted Matrix
November 1, 2023
Problem statement You are given an n x n matrix where each row and column is sorted in ascending order. Your task is to find the k-th smallest element in...
Leetcode 890. How To Find The Strings of a Given Pattern
October 27, 2023
Problem statement You are provided with a list of strings named words and a string named pattern. Your task is to find the strings from words that match the...
Leetcode 242. How To Check If a String Is a Valid Anagram
October 27, 2023
Problem statement You are given two strings, s and t. Your task is to determine whether t is an anagram of s. If t is an anagram of s, return true;...
Leetcode 797. How to Find All Paths From a Source to a Target in a Graph
October 23, 2023
Find all paths from the source to the target in a directed acyclic graph using Depth-First Search.
Leetcode 739. How Long To Reach A Warmer Day
October 21, 2023
Problem statement You are given an array of integers temperatures, which represents the daily temperatures. Your task is to create an array answer such that...
Leetcode 876. How To Find The Middle Node of a Linked List
October 21, 2023
Problem statement Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle...
Leetcode 368. How To Find The Largest Divisible Subset of a Given Integer Set
October 20, 2023
Find the largest subset of distinct positive integers where each element is a multiple of another, represented using index mapping for optimal performance.
Older archives