Update 刷题.md

This commit is contained in:
JZFamily 2018-06-23 18:52:35 +08:00 committed by GitHub
parent a6ee092cda
commit 8654ff9fe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,10 +22,10 @@ update salary
### 北河 ### 北河
* 第一版 :392ms * 第一版 :392ms
```c++ ```c++
class Solution { class Solution {
public: public:
int lengthOfLongestSubstring(string s) { int lengthOfLongestSubstring(string s) {
map<char, short> v; map<char, short> v;
int max_num = 0; int max_num = 0;
@ -47,13 +47,13 @@ update salary
} }
return max_num; return max_num;
} }
}; };
``` ```
* 第2版 :32ms * 第2版 :32ms
```c++ ```c++
class Solution { class Solution {
public: public:
int lengthOfLongestSubstring(string s) { int lengthOfLongestSubstring(string s) {
map<char, short> v; map<char, short> v;
int max_num = 0; int max_num = 0;
@ -87,8 +87,8 @@ update salary
} }
return max_num; return max_num;
} }
}; };
``` ```
### jzf :252 ms 8 ### jzf :252 ms 8
```c++ ```c++
class Solution { class Solution {
@ -231,10 +231,10 @@ public:
### jzf ### jzf
* 第一版 超时 复杂度 n*2^n * 第一版 超时 复杂度 n*2^n
```c++ ```c++
class Solution { class Solution {
public: int findTargetSumWays(vector<int>& nums, int S) { public: int findTargetSumWays(vector<int>& nums, int S) {
int n = 0; int n = 0;
int sum = 0; int sum = 0;
int b = 0; int b = 0;
@ -257,9 +257,9 @@ public:
} }
return sum; return sum;
} }
}; };
``` ```
* 第二版 * 第二版
### kiritow 24ms 2 ### kiritow 24ms 2
```c++ ```c++
@ -341,7 +341,7 @@ var isPalindrome = function(x) {
* 第二版 128ms * 第二版 128ms
```c++ ```c++
class Solution { class Solution {
int list[10],len=0,i=0; int list[10],len=0,i=0;
public: public:
bool isPalindrome(int x) { bool isPalindrome(int x) {
if(x<0)return false; if(x<0)return false;
@ -401,10 +401,10 @@ public:
} }
}; };
``` ```
* 第2版 140ms * 第2版 140ms
```c++ ```c++
class Solution { class Solution {
public: bool isPalindrome(int x) { public: bool isPalindrome(int x) {
int mod; int mod;
int sh =x; int sh =x;
vector<int> vec; vector<int> vec;
@ -436,7 +436,7 @@ public:
} }
return true; return true;
} }
}; };
``` ```
### 北河 244ms ### 北河 244ms