leetcode解法大全
文章平均质量分 68
leetcode每题的答案代码,算法分析详解,还有一题多解
hellochenlu
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
53 - 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,1,−5,4], the contiguous subarray [4,−1,2,1]原创 2016-03-07 10:24:45 · 586 阅读 · 0 评论 -
50 - Pow(x, n)
用二分法,O(logn)。注意n /* */ #include "stdafx.h" #include using namespace std; class Solution_050_PowXn { public: double power(double x, int n) { if (n == 0) { return 1; } double v = pow转载 2016-03-04 14:52:53 · 591 阅读 · 0 评论 -
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: For原创 2016-03-04 13:28:28 · 497 阅读 · 0 评论 -
48 - RotateImage
Rotate Image 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?原创 2016-03-04 10:12:13 · 772 阅读 · 0 评论 -
46 - Permutations(全排列和递归)
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], and [3,2,1]. Subscrib原创 2016-03-03 10:37:44 · 1386 阅读 · 1 评论
分享