LeetCode weekly contest 175
本周由于眼镜坏掉了,不在状态。在家吃饭也晚,所以题目并没有做完。
RankNameScoreFinish TimeQ1 (3)Q2 (4)Q3 (5)Q4 (6)1378 / 7826YoungForest70:11:410:06:510:11:41nullnull 1346. Check If N and Its Double Exist
使用一个hashmap存储之前见到过的数即可。
时间复杂度: O(N),
空间复杂度: O(N).
1
2
3
4
5
6
7
8
9
10
11
12
class Solution {
public:
bool checkIfExist