- 博客(5)
- 收藏
- 关注
原创 LeetCode: 继续easy题9
Escape The Ghosts""""""class Solution {public: int distance(vector<int>& s1, vector<int>& s2){ return abs(s1[0]-s2[0])+abs(s1[1]-s2[1]); } bool escapeGho..
2018-02-27 06:10:19 250
原创 LeetCode: 继续easy题8
Nth Digit"""蛋疼,老Time Limit Exceeded,结果最后是两个long的地方越界"""class Solution {public: int findNthDigit(int n) { /* i=1: 1,...,9: 9 num_i i=2: 10,...,99: 90 ...
2018-02-25 12:35:12 299
原创 LeetCode: 继续easy题7
Reverse Vowels of a String """"""class Solution {public: bool isVowel(char a){ if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u') return true; if(a=='A'||a=='E'||a=='...
2018-02-16 04:33:48 298
原创 LeetCode: 继续easy题6
Lowest Common Ancestor of a Binary Search Tree"""递归解法,想好边界条件,简单"""/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * ...
2018-02-12 10:51:11 278
原创 LeetCode: 继续easy题5
Contains Duplicate"""简单O(n), O(n)"""class Solution {public: bool containsDuplicate(vector<int>& nums) { unordered_map<int,int> map; for (int i=0; i<nums...
2018-02-11 21:35:43 262
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人