创新班每日打卡
没昵称你有意见?
I can do all thing!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
leectcode Longest Substring Without Repeating Ch 日常刷题
#include<iostream> using namespace std; #include<string> class Solution { public: int lengthOfLongestSubstring(string s) { int count = 0; int start = 0; int lon...原创 2019-04-06 14:40:41 · 98 阅读 · 0 评论 -
LeetCode Valid Parentheses 日常刷题
#include <iostream> #include <stack> #include <string> using namespace std; class Solution { public: bool isValid(string s) { stack<char> temp; ...原创 2019-04-30 01:12:19 · 163 阅读 · 0 评论 -
Leetcode Remove Nth Node From End of List 日常刷题
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* rem...原创 2019-04-28 20:29:53 · 160 阅读 · 0 评论 -
Leetcode 4Sum 日常刷题
#include<iostream> using namespace std; #include<vector> #include<algorithm> class Solution { //先确定第一和第二个元素,再用双指针的方法从两边向中间夹的方法确定第三和第四个元素! public: vector<vector&l...原创 2019-04-24 02:32:07 · 114 阅读 · 0 评论 -
Leetcode Letter Combinations of a Phone Number 日常刷题
#include<iostream> using namespace std; #include<vector> #include<string> class Solution { public: vector<string> letterCombinations(string digits) { vector<string>...原创 2019-04-28 02:26:26 · 158 阅读 · 0 评论 -
Leetcode 3Sum 日常刷题
#include<iostream> using namespace std; #include<algorithm> #include<vector> class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { sort...原创 2019-04-23 02:02:20 · 116 阅读 · 0 评论 -
Leetcode Longest Common Prefix 日常刷题
#include<iostream> using namespace std; #include<string> #include<vector> #include<algorithm> class Solution { public: string longestCommonPrefix(vector<string>& st...原创 2019-04-22 01:22:09 · 142 阅读 · 0 评论 -
leetcode Container With Most Water 日常刷题
class Solution { public: int maxArea(vector<int>& height) { int x = 0, y = height.size() - 1; int res = 0; while (x < y) { res = max(res, (y - x)*min(height[x], heig...原创 2019-04-17 08:56:58 · 108 阅读 · 0 评论 -
Leetcode Roman to Integer 日常刷题
#include<iostream> using namespace std; #include<unordered_map> class Solution { public: int romanToInt(string s) { int res=0; unordered_map<char,int> Map = { {'I', 1}, {'V', 5...原创 2019-04-21 02:27:04 · 141 阅读 · 0 评论 -
LeetCode Integer to Roman 日常刷题
#include<iostream> using namespace std; #include<string> class Solution { public: string intToRoman(int num) { string str=""; string str_1[14] = { "M","CM","D","CD","C","XC","L","XL"...原创 2019-04-21 02:02:38 · 119 阅读 · 0 评论 -
leetcode ZigZag Conversion 日常刷题
Leetcode ZigZag Conversion 观察规律可得: 当 n = 2 时: 0 2 4 6 8 A C E 1 3 5 7 9 B D F 当 n = 3 时: 0 4 8 C 13579BDF 2 6 A E 当 n = 4 时: 0 6 C 1 57 BD 24 ...原创 2019-04-13 14:42:30 · 337 阅读 · 0 评论 -
leetcode String to Integer (atoi) 日常刷题
#include<iostream> #include<string> using namespace std; class Solution { public: int myAtoi(string str) { long long res = 0; bool flag; //用flag来判断正负数! int nl = 0; if (str.e...原创 2019-04-15 18:54:17 · 112 阅读 · 0 评论 -
LeetCode Longest Palindromic Substring 日常刷题
class Solution { public: string longestPalindrome(string s) { string t = "$#"; for (int i = 0; i < s.size(); ++i) { t += s[i]; t += '#'; } //利用了 M...原创 2019-04-12 01:44:26 · 121 阅读 · 0 评论 -
LeetCode Reverse Integer 日常刷题
class Solution { public: int reverse(int x) { int ret = 0; while (x != 0) { // handle overflow/underflow if (abs(ret) > 214748364) return 0; re...原创 2019-04-08 16:15:04 · 115 阅读 · 0 评论 -
leetcode Palindrome Number 日常刷题
class Solution { public: bool isPalindrome(int x) { if(x<0) return false; //负数不算回文数 int temp=0, y=x; while(y) { if(abs(temp)>(INT_MAX/10)) return false...原创 2019-04-08 16:10:51 · 81 阅读 · 0 评论 -
leetcode Median of Two Sorted Arrays 日常打卡
class Solution { public: double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) { int len1 = nums1.size(); int len2 = nums2.size(); int len = len1 + len2; ...原创 2019-04-10 23:43:00 · 145 阅读 · 0 评论 -
leecode Add Two Numbers 日常刷题
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* ad...原创 2019-04-06 15:38:52 · 129 阅读 · 0 评论 -
leetcode Two Sum 日常刷题
#include<iostream> using namespace std; #include<vector> class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { int work = 0; ...原创 2019-04-06 15:31:58 · 111 阅读 · 0 评论 -
Leetcode Merge Two Sorted Lists 日常刷题
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* ...原创 2019-05-01 16:37:47 · 311 阅读 · 0 评论
分享