关于Leetcode
来源:互联网 发布:美股王软件 编辑:程序博客网 时间:2024/06/10 09:39
在Github上开了一个关于leetcode的repository.
如果你也有兴趣可以把你的解法通过github上传,一起印证和学习.
https://github.com/LiLane/leetcode
例子1:
class Solution {public: /* Result: 26ms时间复杂度:O(n)空间复杂度:O(n)Author:Lane0x */ vector<int> twoSum(vector<int> &num,int target){ unordered_map<int,int> mapping; vector<int> result; for(int i = 0; i < num.size(); ++i) mapping[num[i]] = i; for(int i = 0; i < num.size(); ++i){ const int gap = target - num[i]; if(mapping.find(gap) != mapping.end() && mapping[gap] > i){ result.push_back(i + 1); result.push_back(mapping[gap] + 1); break; } } return result; }};
0 0
- 关于Leetcode
- 关于全排列 leetcode
- 【leetcode】关于代码的优化
- leetcode -- 关于dp的问题
- 关于leetcode的一点注意事项
- 关于最近刷leetcode总结
- [LeetCode刷题笔记] 关于LeetCode的前言
- LeetCode(一)关于GrayCode的实现
- LeetCode(二)关于TwoSum的实现
- LeetCode(三)关于ThreeSum的实现
- 关于开启leetcode刷题文章
- 关于LeetCode算法题,第一题
- LeetCode: 关于Sum的题目合集
- 关于leetcode中整形溢出的几道题。
- 关于leetcode中链表操作的的几道题。
- 关于leetcode中c++ STL 的几道题
- 关于leetcode中游戏相关的几道题。
- leetcode 关于树的一些题目
- 数据类型和常用运算
- NS3实例分析(4)-- third.cc
- 《剑指Offer》面试题7:用两个栈实现队列
- 小米2015笔试第二题
- 子数组之和的最大值(二维)
- 关于Leetcode
- C语言出现“烫”字符的内存分析
- 《C++编程》第3章第17题
- P122.17
- 什么是shell
- 【声明】本博客部分文章来自本人51CTO博客:jiyanle.blog.51cto.com
- 《算法一》—单向链表
- H - Tickets HDU 1260 (动态规划)
- 动态代理模式