算法
hugh Lee
手下见真章
展开
-
326. Power of Three
Power of Three 判断3的次方数原创 2017-09-26 09:05:04 · 278 阅读 · 0 评论 -
283.MoveZeroes
题目 283.MoveZeroes Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0,原创 2018-01-10 17:15:23 · 350 阅读 · 0 评论 -
时间复杂度和空间复杂度
一,求解算法的时间复杂度其具体步骤是: ⑴ 找出算法中的基本语句; 算法中执行次数最多的那条语句就是基本语句,通常是最内层循环的循环体。 ⑵ 计算基本语句的执行次数的数量级; 只需计算基本语句执行次数的数量级,这就意味着只要保证基本语句执行次数的函数中的最高次幂正确即可,可以忽略所有低次幂和最高次幂的系数。这样能够简化算法分析,并且使注意力集中在最重要的一点上:增长率。转载 2018-01-09 13:35:02 · 455 阅读 · 0 评论 -
581. Shortest Unsorted Continuous Subarray
题目:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.You need to原创 2018-01-11 20:12:35 · 582 阅读 · 0 评论 -
387. First Unique Character
leetcode编程原创 2017-09-29 14:47:50 · 306 阅读 · 0 评论 -
18. 4Sum
leetcode的编程题18. 4sum原创 2017-09-28 21:29:01 · 260 阅读 · 0 评论 -
454. 4Sum II
leetcode 算法题原创 2017-09-28 13:11:39 · 272 阅读 · 0 评论 -
628. Maximum Product of Three Numbers
leetcode题原创 2017-09-26 21:34:43 · 252 阅读 · 0 评论 -
转】动态规划——入门篇
动态规划相信大家都知道,动态规划算法也是新手在刚接触算法设计时很苦恼的问题,有时候觉得难以理解,但是真正理解之后,就会觉得动态规划其实并没有想象中那么难。网上也有很多关于讲解动态规划的文章,大多都是叙述概念,讲解原理,让人觉得晦涩难懂,即使一时间看懂了,发现当自己做题的时候又会觉得无所适从。我觉得,理解算法最重要的还是在于练习,只有通过自己练习,才可以更快地提升。话不多说,接下来,下面我就通过一个...转载 2018-04-21 15:56:30 · 630 阅读 · 0 评论