You are given n pairs of numbers. In every pair, the first number is always smaller than the …
分类:LeetCode
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…
303. Range Sum Query - Immutable
题目: https://leetcode.com/problems/range-sum-query-immutable/ tag : DP 难度 : Easy sum(i, j) = nums[i] j = i sum(…
LeetCode算法题-Longest Harmonious Subsequence(Java实现)
这是悦乐书的第270次更新,第284篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第136题(顺位题号是594)。我们定义一个和谐数组是一个数组,其最大值和最小值之间的差值恰好为1。给定一个…
三数之和
三数之和 给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且不重复的三元组。 注意:答案中不可以包含重复的三元组。 例如, …
[LeetCode By Go 34]383. Ransom Note
题目 Given an arbitrary ransom note string and another string containing letters from all the magazines, write a…
64. Minimum Path Sum
64. Minimum Path Sum 题目 Given a m x n grid filled with non-negative numbers, find a path from top left to bott…
106. Construct Binary Tree from Inorder and Postorder Traversal
欢迎fork and star:Nowcoder-Repository-github 106. Construct Binary Tree from Inorder and Postorder Traversal 题目 …
[LeetCode] Second Highest Salary 第二高薪水
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ |…
LeetCode 235 Lowest Common Ancestor of a Binary Search Tree
题目描述 Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. Ac…
208. Implement Trie (Prefix Tree)
Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("ap…