leetcode代码
古宇hhh
学习中!!!!
展开
-
LeetCode 21. 合并两个有序链表
代码:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNo...原创 2019-03-01 09:57:37 · 107 阅读 · 0 评论 -
leetcode 1.两数之和
class Solution {public: vector<int> twoSum(vector<int>& nums, int target) { vector<int>vec; for(int i=0;i<nums.size();i++){ for(int j=i+1;j&l...原创 2019-03-01 10:29:40 · 85 阅读 · 0 评论 -
leetcode 7.整数反转
class Solution {public: int reverse(int x) { long long t = 0; while(x!=0){ t*=10; t+=x%10; x/=10; } if(t>=INT_MAX)...原创 2019-03-01 10:35:35 · 104 阅读 · 0 评论 -
leetcode 983. 最低票价 dp
class Solution {public: int mincostTickets(vector<int>& days, vector<int>& costs) { int dp[400]; memset(dp, 0, sizeof dp);dp[0]=costs[0]; for(int i=1;...原创 2019-03-01 11:16:50 · 235 阅读 · 0 评论