Given a matrix of m x n elements (m rows, ncolumns), return all elements …
分类:LeetCode题目解答
[Leetcode] Distinct Subsequences 不同顺序字串
Distinct Subsequences Given a string S and a string T, count the number of distinct subsequences of T in S. A …
[LeetCode] Nth Highest Salary 第N高薪水
Write a SQL query to get the nth highest salary from the Employee table. +----+----…
[LeetCode] Range Addition 范围相加
Assume you have an array of length n initialized with all 0‘s and are given k update operations. …
[LeetCode] Minimum ASCII Delete Sum for Two Strings 两个字符串的最小ASCII删除和
Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equa…
[LeetCode] Contain Virus 包含病毒
A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls. The…
LeetCode | Combination Sum
题目: Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C …
[LeetCode] Container With Most Water 装最多水的容器,Trapping Rain Water 收集雨水
Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai).…
[LeetCode] Copy List with Random Pointer 拷贝带有随机指针的链表
A linked list is given such that each node contains an additional random pointer which could point to a…
[LeetCode] Maximum Length of Pair Chain 链对的最大长度
You are given n pairs of numbers. In every pair, the first number is always smaller than the …
LeetCode | Path Sum II
题目: Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given su…
[Leetcode] Best Meeting Point 最佳见面点
Best Meeting Point A group of two or more people wants to meet and minimize the total travel distance. You are…