题目 Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 解题思路 根据一个…
分类:LeetCode
97. Interleaving String
97. Interleaving String 题目 Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For e…
116. Populating Next Right Pointers in Each Node
欢迎fork and star:Nowcoder-Repository-github 116. Populating Next Right Pointers in Each Node 题目 Given a binary …
[LeetCode] Ugly Number II 丑陋数之二
Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors onl…
169. Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more tha…
2018-05-08 69. Sqrt(x)
题意:给你一个数x,返回它的平方根,如果平方根是小数,向下取整。 解题思路:使用二分查找x的平方根ans,条件是不满足ans * ans > x,且满足(ans + 1) * (ans + 1) > x,此时…
[LeetCode] Insert Interval 插入区间
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary)…
K数和
题目: 给定n个不同的正整数,整数k(k < = n)以及一个目标数字。 在这n个数里面找出K个数,使得这K个数的和等于目标数字,求问有多少种方案? 您在真实的面试中是否遇到过这个题? Yes 样例 给出[1,2,…
给你的leetcode submission 提速(C++)
leetcode 的 submission 是收到 IO 速度的影响的……对,没错,尽管和其他 OJ 网站不同, leetcode 给你提供了完备的代码级的接口,它的测试例仍旧是通过 IO 来读取的,真是让人桑心。 明白…
[LeetCode] 3. Longest Substring Without Repeating Characters 题解
问题描述 输入一个字符串,找到其中最长的不重复子串 例1: 输入:"abcabcbb" 输出:3 解释:最长非重复子串为"abc" 例2: 输入:"bbbbb" 输出:1 解释:最长非重复子串为"b" 例3: 输入:"p…
671. Second Minimum Node In a Binary Tree
Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this…
Leetcode 85. Maximal Rectangle
Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1R…