- 博客(10)
- 收藏
- 关注
原创 [Leetcode刷题]Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers
2016-07-05 07:24:15 217
原创 [Leetcode刷题]Missing Ranges
Given a sorted integer array where the range of elements are [lower, upper] inclusive, return its missing ranges.For example, given [0, 1, 3, 50, 75], lower = 0 and upper = 99, return ["2", "4->
2016-06-25 09:51:38 182
原创 [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; given n =
2016-06-25 08:42:19 157
原创 [Leetcode刷题]Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].Thoughts遍历检查数列是否+1递增,不是则进行下一个loop注意检查borderSo
2016-06-25 07:25:02 137
原创 [Leetcode刷题]Number of Islands
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may as
2016-06-22 06:27:31 211
原创 [Leetcode刷题]Plus One
下周Google面试T.T决定先刷Google的题目好啦~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 the head
2016-06-22 03:20:40 118
原创 [Leetcode刷题]Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ext
2016-06-17 07:37:16 161
原创 [Leetcode刷题]Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Thoughts本来想用java string split成words,push到stack上再pop出来。后来发现好像没有用s
2016-06-17 03:59:17 160
原创 [Leetcode刷题]Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link
2016-06-17 03:43:22 129
原创 [Leetcode刷题]Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nums = [
2016-06-17 01:28:27 130
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人