2015年5月8日
摘要: Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2015-05-08 00:43 黄瓜小肥皂 阅读(147) 评论(0) 推荐(0) 编辑
  2015年5月7日
摘要: Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4... 阅读全文
posted @ 2015-05-07 23:45 黄瓜小肥皂 阅读(138) 评论(0) 推荐(0) 编辑
  2015年5月6日
摘要: 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 shoul... 阅读全文
posted @ 2015-05-06 10:49 黄瓜小肥皂 阅读(109) 评论(0) 推荐(0) 编辑
摘要: II:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).Fo... 阅读全文
posted @ 2015-05-06 09:52 黄瓜小肥皂 阅读(118) 评论(0) 推荐(0) 编辑
  2015年5月5日
摘要: Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both? ... 阅读全文
posted @ 2015-05-05 15:02 黄瓜小肥皂 阅读(147) 评论(0) 推荐(0) 编辑
摘要: A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index.... 阅读全文
posted @ 2015-05-05 08:46 黄瓜小肥皂 阅读(137) 评论(0) 推荐(0) 编辑
  2015年5月4日
摘要: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space... 阅读全文
posted @ 2015-05-04 12:17 黄瓜小肥皂 阅读(174) 评论(0) 推荐(0) 编辑
  2015年5月3日
摘要: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted fr... 阅读全文
posted @ 2015-05-03 20:58 黄瓜小肥皂 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order.For example,Given n = 3,You should return the followin... 阅读全文
posted @ 2015-05-03 20:04 黄瓜小肥皂 阅读(137) 评论(0) 推荐(0) 编辑
  2015年5月2日
摘要: What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the array.... 阅读全文
posted @ 2015-05-02 11:27 黄瓜小肥皂 阅读(95) 评论(0) 推荐(0) 编辑