上一页 1 2 3 4 5 6 7 8 9 10 ··· 19 下一页
摘要: 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 0, 1... 阅读全文
posted @ 2017-02-10 21:01 copperface 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be unique.The result can be in any ... 阅读全文
posted @ 2017-02-10 11:18 copperface 阅读(178) 评论(0) 推荐(0) 编辑
摘要: You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?来源: https://leetcode.com/problems/rotate-image/分析方法1:关键在于找到旋转90°的... 阅读全文
posted @ 2017-02-09 20:42 copperface 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[ [1,1,2], [1,2,1], [2,1,1] ] 来源: ... 阅读全文
posted @ 2017-02-09 18:38 copperface 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ]来源: htt... 阅读全文
posted @ 2017-02-09 15:57 copperface 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.Note:The length of both num1 and num2 is =0; --i){ string tmp = multi(num1, num2[i]... 阅读全文
posted @ 2017-02-09 14:55 copperface 阅读(200) 评论(0) 推荐(0) 编辑
摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combination.N... 阅读全文
posted @ 2017-02-08 23:29 copperface 阅读(173) 评论(0) 推荐(0) 编辑
摘要: Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C... 阅读全文
posted @ 2017-02-08 10:53 copperface 阅读(657) 评论(0) 推荐(0) 编辑
摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as "one 2, then o... 阅读全文
posted @ 2017-02-08 09:36 copperface 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 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 order.You may assume no duplicates in the array.Here... 阅读全文
posted @ 2017-02-06 14:43 copperface 阅读(175) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 19 下一页