LeetCode
文章平均质量分 74
sinat_24310873
湾区实习中。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[C++]LeetCode #1 twoSum
class Solution { public: vector twoSum(vector& nums, int target) {//返回类型为vector的int型的函数 vector sum;//先声明一个vector变量 for(int i=0;i<nums.size();i++){ for(int j=i+1;j<nums.原创 2016-11-24 06:27:47 · 425 阅读 · 0 评论 -
[C++] LeetCode #6 ZigZag Conversion
class Solution { public: string convert(string s, int numRows) { string ans; int length=s.size(); int step=2*numRows-2; if(numRows==1) { ans=s;原创 2016-11-24 17:51:01 · 349 阅读 · 0 评论 -
[c++]Leetcode #7 reverse number
7. Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you thought about this? Here are some good questions原创 2016-11-26 17:31:22 · 351 阅读 · 0 评论 -
[C++]next_permutation()函数解析
C++/STL中定义的next_permutation和prev_permutation函数则是非常灵活且高效的一种全排列方法,需要有头文件, 它被广泛的应用于为指定序列生成不同的排列。按照STL文档的描述,next_permutation函数将按字母表顺序生成给定序列的下一个较大的序列,直到整个序列为减序为止。prev_permutation函数与之相反,是生成给定序列的上一个较小的序列。二者原原创 2016-11-27 06:27:57 · 2718 阅读 · 0 评论 -
[C++]Leetcode #8 atoi()
class Solution { public: int myAtoi(string str) { int n=str.length(); int number[n]; int j=-1, flag=0; for(int i=0;i<n;i++) { if(str[i]=='+' || st原创 2016-12-20 05:32:08 · 482 阅读 · 0 评论
分享