- 博客(6)
- 收藏
- 关注
原创 leetcode#210 Course Schedule
题目: There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is >express
2016-10-16 14:06:36 314
原创 leetcode#77 Combinations
题目描述 Given two integers n and k, return all possible combinations of k numbers out of 1 … n. For example, If n = 4 and k = 2, a solution is: [ [2,4], [3,4],
2016-10-15 08:58:43 361
原创 leetcode#58 Length of Last Word
题目描述 Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the >length of last word in the string. If the last word does not exist, return 0. Note:
2016-10-14 18:32:38 248
原创 leetcode#321 Create Maximum Numbers
Given two arrays of length m and n with digits 0-9 representing two numbers. Create the >maximum number of length k <= m + n from digits of the two. The relative order of the digits >from the same arra
2016-10-13 19:14:52 398
原创 leetcode#15 Three Sum
这道题是Two Sum的升级版。本来想写一个三重循环暴力,结果超时了。后来我仔细想了想其实是用了STL的find函数所以超时的。 最后是用夹逼法写while循环做的:class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { vector<vector<int>> res;
2016-10-12 21:19:49 294
原创 leetcode#1 Two Sum
水题一个,直接用冒泡做了,但是很奇怪的是用vector<int> iterator和size_t的运行时间差了很多。前者直接就超时了,后者AC。class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { size_t n = nums.size(); vector<i
2016-10-12 12:40:39 347
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人