leetcode
文章平均质量分 91
NachtZ
这个作者很懒,什么都没留下…
展开
-
Leetcode第四周周赛
用golang做了1,2,4题,第3题golang总是有问题换成c++来做。 代码地址:leetcode solution(golang)396. Rotate Function最暴力的方法莫过于一遍一遍计算。可以得到结果。 第二种方法就是利用了前一次的结果。 假设数组为 [a,b,c,d] 那么第一次计算的结果就是: 0*a + 1*b + 2*c + 3*d 第二次计算的结果是(从原创 2016-09-12 10:20:33 · 779 阅读 · 0 评论 -
LeetCode Golang 答案
Leetcode用golang实现的答案。全都会push到github上。 已经有的题目和答案链接如下: Question Solutioin 1.two sum [1.two sum.py](https://github.com/NachtZ/leetcode/blob/master/1.two sum.py) Add Two Numbers [2. Add Two Num原创 2017-05-28 08:09:39 · 2921 阅读 · 2 评论 -
Smarking Algorithm Contest 2
435. Non-overlapping IntervalsGiven a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note: 1. You may assume the int原创 2016-10-30 12:21:52 · 440 阅读 · 2 评论 -
LeetCode Weekly Contest 9 第九周周赛
Leetcode 第九周周赛,第422,423,424题。原创 2016-10-16 14:11:25 · 446 阅读 · 0 评论 -
Smarking Algorithm Contest 3
1. 453. Minimum Moves to Equal Array ElementsGiven a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 e原创 2016-11-06 12:23:09 · 539 阅读 · 0 评论 -
Leetcode第十周周赛Smarking Algorithm Contest
Leetcode 周赛440. K-th Smallest in Lexicographical Order439. Ternary Expression Parser438. Find All Anagrams in a String437. Path Sum III原创 2016-10-23 12:42:43 · 629 阅读 · 0 评论 -
LeetCode第六周周赛
404. Sum of Left Leaves不解释func isLeaf(root * TreeNode) bool{ if root == nil || root.Left!=nil || root.Right!=nil{ return false } return true;}func sumOfLeftLeaves(root *TreeNode)原创 2016-09-25 14:00:47 · 591 阅读 · 0 评论 -
LeetCode Weekly Contest 8 第八周周赛
415. Add StringsGiven two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2.就是模拟加法,将两个字符串表示的数字相加。其中字符串的长度均不超过5100,字符串中只有0-9,即不可能有负数的情况。解法很简单,就是按照小学时候教的加法运算来做就行了。原创 2016-10-09 14:37:48 · 988 阅读 · 0 评论 -
Leetcode第五周周赛
400. Nth Digit401. Binary Watch402. Remove K Digits403. Frog Jump原创 2016-09-18 12:32:04 · 521 阅读 · 0 评论 -
数据结构与算法
整理和自己总结的部分数据结构和算法。数据结构队列特点是FIFO。是一种常见的数据结构。可用链表和数组实现。 出队时,链表只需要给出链头并将链头重新指向即可,而数组则需要进行一次全数组移动的操作。 入队时,链表需要遍历一遍链表,数组则不需要。 扩容时,链表是需要遍历一次,而数组需要进行一次拷贝。 操作 链表实现复杂度 数组实现复杂度 出队 1 n 入队 n 1原创 2017-05-28 08:11:18 · 1566 阅读 · 0 评论