View two_sum.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
vector<int> twoSum(vector<int>& nums, int target) { | |
vector<int> res; | |
map<int, int> numMap; | |
int size = nums.size(); | |
if (size < 2) { | |
return res; | |
} |
View longest_substring_without_repeating_characters.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
inline int lengthOfLongestSubstring(string s) { | |
const int maxs = 96; | |
int pos[maxs]; | |
int ans = 0; | |
int cur = 0; | |
int tmp; | |
int length = s.length(); |