- 博客(11)
- 收藏
- 关注
原创 Leetcode 293: Flip Game
You are playing the following Flip Game with your friend: Given a string that contains only these two characters: + and -, you and your friend take turns to flip two consecutive "++" into "--". Th
2015-12-17 07:55:49 831
原创 Leetcode 165: Compare Version Numbers
Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and co
2015-12-17 07:37:22 274
原创 Leetcode 49: Group Anagrams
Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note:
2015-12-17 07:05:22 472
原创 Leetcode 280: Wiggle Sort
Given an unsorted array nums, reorder it in-place such that nums[0] = nums[2] .For example, given nums = [3, 5, 2, 1, 6, 4], one possible answer is [1, 6, 2, 5, 3, 4].Solution:The rule
2015-12-15 09:27:47 347
原创 Leetcode 240: Search a 2D Matrix II
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 in ascending from left to right.Integers in
2015-12-15 09:03:35 216
原创 Leetcode 74: Search a 2D Matrix
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 from left to right.The first integer of each
2015-12-15 08:46:09 237
原创 Leetcode 162: Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in
2015-12-15 08:29:08 252
原创 Leetcode 154: Find Minimum in Rotated Sorted Array II
Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Solution:If there are duplicates in the rotated a
2015-12-15 08:18:42 310
原创 Leetcode 153: Find Minimum 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).Find the minimum element.You may assume no duplicate exists in
2015-12-15 07:43:27 194
原创 Leetcode 11: Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin
2015-12-15 06:19:15 205
原创 Leetcode243: Shortest Word Distance
Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list.For example,Assume that words = ["practice", "makes", "perfect", "coding", "
2015-12-15 05:56:07 228
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人