自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 leetcode之Flatten Binary Tree to Linked List

题目: Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like:

2016-02-29 20:49:32 213

原创 leetcode之Perfect Squares

题目: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 12, return 3 because 12 = 4 + 4 + 4;

2016-02-29 16:29:49 247

原创 leetcode之linked List cycle && linked List cycle II

题目: linked list cycle: Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? linked list cycle II: Given a linked list, return

2016-02-29 14:46:25 189

原创 leetcode之 Kth Largest Element in an Array

题目: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For example, Given [3,2,1,5,6,4] and k = 2, r

2016-02-29 13:55:58 174

原创 leetcode之Search in Rotated Sorted Array

题目: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target value to search. If found in the ar

2016-02-28 22:27:22 146

原创 leetcode之 Sum Root to Leaf Numbers

题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Find

2016-02-28 12:48:02 228

原创 leetcode之Remove Duplicates from Sorted Array II

题目: Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given sorted array nums = [1,1,1,2,2,3], Your function should return length = 5, with the

2016-02-28 12:40:32 138

原创 leetcode之Super ugly number

题目: Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For example, [1, 2, 4,

2016-02-28 11:57:05 263

原创 leetcode之H-index &&H-index II

题目略,思想相同 解答: 主要就是先排序,然后找到最大的h,在找最大的过程中,可以建模称为一个线相交题目 经过分析可以发现,最大h就是citation这个数组和size - pos(pos是数组下标,size是数组的大小)这两个线连接起来的交点 1.两条线确实有交点,并且交点的横坐标是x,那么这个时候就直接h就是size - x 2.有交点,但是交点的横坐标不是整数,这 个时候就是距离交

2016-02-28 10:23:08 206

原创 leetcode之Binary Search Tree Iterator

题目: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the next smallest number in the BST. Not

2016-02-27 10:36:49 152

原创 leetcode之first bad version

题目: You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed bas

2016-02-23 17:50:43 186

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除