352. Data Stream as Disjoint Intervals
摘要:题目链接: https://leetcode.com/problems/data-stream-as-disjoint-intervals/ Given a data stream input of non-negative integers a1, a2, ..., an, ..., summar
阅读全文
posted @
2016-06-27 11:04
已停更
阅读(709)
推荐(0) 编辑
Convert Sorted Array to Binary Search Tree
摘要:题目:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.把有序数组转化为二叉搜索树解析:不会做,看了答案感觉思想很简单,就是将数组中中间的数字当成跟,左子树...
阅读全文
posted @
2015-11-27 14:44
已停更
阅读(202)
推荐(0) 编辑
Remove Duplicates from Sorted List
摘要:题目:Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, r...
阅读全文
posted @
2015-11-27 10:57
已停更
阅读(193)
推荐(0) 编辑
Climbing Stairs
摘要:题目:You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl...
阅读全文
posted @
2015-11-20 09:18
已停更
阅读(158)
推荐(0) 编辑
Maximum Subarray
摘要:题目:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2...
阅读全文
posted @
2015-11-17 09:22
已停更
阅读(225)
推荐(0) 编辑
Find the Duplicate Number
摘要:题目:Given an arraynumscontainingn+ 1 integers where each integer is between 1 andn(inclusive), prove that at least one duplicate number must exist. Ass...
阅读全文
posted @
2015-11-16 10:29
已停更
阅读(171)
推荐(0) 编辑
Reverse Linked List
摘要:题目:单链表逆置,必须掌握Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you imp...
阅读全文
posted @
2015-11-13 10:53
已停更
阅读(200)
推荐(0) 编辑
Single Number II
摘要:题目:Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime c...
阅读全文
posted @
2015-11-12 13:58
已停更
阅读(141)
推荐(0) 编辑
Roman to Integer & Integer to Roman
摘要:题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.解析:这题没兴趣做,抄答案http://blog.csdn.net/jellyyi...
阅读全文
posted @
2015-11-12 10:29
已停更
阅读(182)
推荐(0) 编辑
Search Insert Position
摘要:题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in...
阅读全文
posted @
2015-11-12 09:27
已停更
阅读(146)
推荐(0) 编辑
Unique Binary Search Trees II
摘要:题目:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 ...
阅读全文
posted @
2015-11-11 15:20
已停更
阅读(155)
推荐(0) 编辑
Unique Binary Search Trees
摘要:题目:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. ...
阅读全文
posted @
2015-11-11 14:02
已停更
阅读(160)
推荐(0) 编辑
Populating Next Right Pointers in Each Node
摘要:题目:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next poi...
阅读全文
posted @
2015-11-10 15:25
已停更
阅读(186)
推荐(0) 编辑
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?解析: 1 class Solution { 2 public: 3 ...
阅读全文
posted @
2015-11-10 11:24
已停更
阅读(149)
推荐(0) 编辑
Missing Number
摘要:题目:Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0, 1, 3]re...
阅读全文
posted @
2015-11-10 10:47
已停更
阅读(158)
推荐(0) 编辑
Binary Tree Inorder Traversal
摘要:题目:Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].N...
阅读全文
posted @
2015-11-09 15:27
已停更
阅读(159)
推荐(0) 编辑
Binary Tree Preorder Traversal
摘要:题目:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3]....
阅读全文
posted @
2015-11-06 09:50
已停更
阅读(215)
推荐(0) 编辑
Majority Element
摘要:题目:Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the ...
阅读全文
posted @
2015-11-05 21:32
已停更
阅读(178)
推荐(0) 编辑
Valid Anagram
摘要:题目:Given two stringssandt, write a function to determine iftis an anagram ofs.For example,s= "anagram",t= "nagaram", return true.s= "rat",t= "car", re...
阅读全文
posted @
2015-11-05 15:16
已停更
阅读(176)
推荐(0) 编辑
Number of 1 Bits
摘要:题目:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit...
阅读全文
posted @
2015-11-05 14:23
已停更
阅读(224)
推荐(0) 编辑