Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = “…
分类:LeetCode
LeetCode[14] - ThreeSumSmaller
一般的O(n3)肯定不行。在此基础上优化。 发现j,k满足条件时候,(k – j)就是所有 sum <target的情况了。 而一旦>target, 又因为j不能后退,只能k–,那么问…
70. Climbing Stairs
70. Climbing Stairs 题目 You are climbing a stair case. It takes n steps to reach to the top. Each time you can …
[LeetCode] Merge k Sorted Lists 合并k个有序链表,Merge Two Sorted Lists 混合插入有序链表
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. &nbs…
[LeetCode] Duplicate Emails 重复的邮箱
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Email |…
[LeetCode] Minimum Height Trees 最小高度树,Course Schedule 课程清单
For a undirected graph with tree characteristics, we can choose any node as the root. The result graph …
[LeetCode] Valid Word Square 验证单词平方
Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a vali…
[Leetcode] Divide Two Integers 整数整除
Divide Two Integers Divide two integers without using multiplication, division and mod operator. If it is over…
[Leetcode] 3Sum Smaller 三数较小和
3Sum Smaller Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 …
[Leetcode] Restore IP Address 修复IP地址
Restore IP Address Given a string containing only digits, restore it by returning all possible valid IP addres…
[Leetcode] Binary Tree Right Side View 二叉树右视图
Binary Tree Right Side View Given a binary tree, imagine yourself standing on the right side of it, return the…
【leetcode】98. Validate Binary Search Tree 二叉树是否是中序有序的
1. 题目 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as fol…