- 博客(14)
- 收藏
- 关注
原创 61. Rotate List
题目Given a list, rotate the list to the right by k places, where k is non-negative.Example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.解析题意是让旋转一个链表,一开始想到的是快慢指针,但是实现之后发现十分的麻烦,有许多指针移动的操
2017-12-17 16:05:27 150
原创 Weekly Contest 63
Min Cost Climbing StairsShortest Completing WordNumber Of Corner RectanglesContain Virus746. Min Cost Climbing Stairs 难度:esayOn a staircase, the i-th step has some non-negative cost cost[i] assig
2017-12-17 12:57:27 333
原创 57. Insert Interval
题目Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example
2017-12-16 12:37:30 173
原创 56. Merge Intervals
题目Given a collection of intervals, merge all overlapping intervals.For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].解析题意:将一个Interval新结构进行合并 关键点在于每次比较用的是ret中的尾Interval。代码/**
2017-12-16 12:06:46 197
原创 50. Pow(x, n)
题目Implement pow(x, n).Example 1:Input: 2.00000, 10 Output: 1024.00000 Example 2:Input: 2.10000, 3 Output: 9.26100解析题意:实现幂运算 分析:主要考察利用二分降低运算时间复杂度,注意当n=INT_MIN时的边界处理,INT_MIN的绝对值比INT_MAX的绝对值大一代码class
2017-12-12 22:48:44 219
原创 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: All input
2017-12-12 22:40:03 144
原创 47. Permutations II
题目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
2017-12-12 22:05:55 162
原创 43. Multiply Strings
题目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 < 110. Both num1 and num2 contains only digits 0-9.
2017-12-11 22:45:34 194
原创 42. Trapping Rain Water
题目Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], r
2017-12-11 22:14:23 154
原创 CSDN-markdown语法
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl
2017-12-10 18:22:21 132
原创 37. Sudoku Solver
题目Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character ‘.’.You may assume that there will be only one unique solution. A sudoku puzzle… …and
2017-12-10 10:45:32 150
原创 36. Valid Sudoku
题目Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’.A partially filled sudoku whic
2017-12-09 16:21:26 136
原创 虚函数总结
1、静态函数不可以是虚函数因为静态成员函数没有this,也就没有存放vptr的地方,同时其函数的指针存放也不同于一般的成员函数,其无法成为一个对象的虚函数的指针以实现由此带来的动态机制。静态是编译时期就必须确定的,虚函数是运行时期确定的。 虚函数的主要意义在于多态(包括静态多态与动态多态,静态体现在模板方面,动态体现在虚函数方面),动态多态体现在动态绑定,然而构造时动态类型都没有完整。 虚函数的
2017-12-08 17:08:31 343
原创 基于c++11的100行实现简单线程池
背景刚粗略看完一遍c++ primer第五版,一直在找一些c++小项目练手,实验楼里面有很多项目,但是会员太贵了,学生党就只能google+github自行搜索完成项目了。注:本文纯提供自己的理解,代码完全照抄,有想法的欢迎评论留言一起讨论。本文参考:c++11线程池实现A simple C++11 Thread Pool implementation涉及到的c++11的特性:std::ve
2017-12-08 12:10:08 22895 11
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人