题目: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For exa…
分类:LeetCode题目解答
LeetCode | Sum Root to Leaf Numbers
题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a nu…
LeetCode | Add Binary
题目: Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1"…
[LeetCode] Consecutive Numbers 连续的数字
Write a SQL query to find all numbers that appear at least three times consecutively. +----+-----+ | Id…
LeetCode| Scramble String
题目: Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substring…
[Algo] Find Intersection of Two Sets 找交集
Find Intersection of Two Sets 暴力法 复杂度 时间 O(NM) 空间 O(1) 思路 暴力解法,对于每个在集合1中的元素,我们遍历一遍集合2看看是否存在,如果存在则是Intersection…
[Leetcode] Reverse Words in a String 反转单词顺序
Reverse Words in a String Given an input string, reverse the string word by word. For example, Given s = ̶…
[LeetCode] Pacific Atlantic Water Flow 太平洋大西洋水流
Given an m x n matrix of non-negative integers representing the height of each unit cell in a continent…
[LeetCode] Find K Closest Elements 寻找K个最近元素
Given a sorted array, two integers k and x, find the k closest elements to&nbs…
力扣(LeetCode)47
题目地址:https://leetcode-cn.com/probl…题目描述:给定一个可包含重复数字的序列,返回所有不重复的全排列。 示例: 输入: [1,1,2]输出:[ [1,1,2], [1,2,1]…
[LeetCode] Lonely Pixel I 孤独的像素之一
Given a picture consisting of black and white pixels, find the number of black lonely pixels.…
LeetCode | Sort List
题目: Sort a linked list in O ( n log n ) time using constant space complexity. 思路: 合并排序法。 代码:…