leetCode
文章平均质量分 79
waaaaht
这个作者很懒,什么都没留下…
展开
-
2Sums&3Sums
从来没刷算法题,但是突然感觉这样还是不完整,听从学长建议从leetcode下手,感受了一下2Sums和3Sums,觉得自己算法真是差太多了。。。从2Sums说起起手双循环,不出意料超时了,于是开始想可以优化的地方,当时想着要是能把所有的遍历过的值的信息储存起来,就可以遍历一遍了,但是我大概觉得这样换个vector储存好像没用,要找匹配的还是要再遍历。于是就没想法了。上网找答案,第一下找原创 2015-08-26 23:40:22 · 566 阅读 · 0 评论 -
leetcode:Median of Two Sorted Arrays
这个题目里说O(log(m+n)),还以为和严格,结果m+n时间的居然过了。。class Solution {public: double findMedianSortedArrays(vector& nums1, vector& nums2) { double cur_num = 0; int count = 0; int medium = (nums1.size() + n原创 2015-08-30 21:30:10 · 192 阅读 · 0 评论 -
The Die Is Cast
题干总时间限制: 1000ms 内存限制: 65536kB描述InterGames is a high-tech startup company that specializes in developing technology that allows users to play games over the Internet. A market analysis has aler原创 2015-09-11 15:13:41 · 363 阅读 · 0 评论 -
Chalkboard XOR Game
We are given non-negative integers nums[i] which are written on a chalkboard. Alice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first. If erasing a number ...原创 2018-04-04 22:35:26 · 170 阅读 · 0 评论