- 博客(13)
- 收藏
- 关注
原创 LeetCode-345. Reverse Vowels of a String
DescriptionWrite a function that takes a string as input and reverse only the vowels of a string.Example 1Given s = "hello", return "holle".Example 2Given s = "leetcode", return "l...
2018-02-28 21:04:02 136
原创 LeetCode-344. Reverse String
DescriptionWrite a function that takes a string as input and returns the string reversed.ExampleGiven s = "hello", return "olleh".Solution 1(C++)class Solution {public: string...
2018-02-28 19:58:25 157
原创 LeetCode-7. Reverse Integer
DescriptionGiven a 32-bit signed integer, reverse digits of an integer.Example 1Input: 123Output: 321Example 2Input: -123Output: -321Example 3Input: 120Output: 21No...
2018-02-27 12:22:08 118
原创 LeetCode-168. Excel Sheet Column Title
DescriptionGiven a positive integer, return its corresponding column title as appear in an Excel sheet.Example 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> A...
2018-02-27 11:58:28 121
原创 LeetCode-69. Sqrt(x)
DescriptionExample 1Example 2Solution 1(C++)class Solution {public: int mySqrt(int x) { long r = x; while (r*r > x) r = (r + x/r) / 2; retur...
2018-02-26 17:23:43 121
原创 LeetCode-400. Nth Digit
DescriptionNoteExample 1Example 2Solution 1(C++)class Solution {public: int findNthDigit(int n) { // step 1. calculate how many digits the number has. lo...
2018-02-26 13:34:27 118
原创 LeetCode-633. Sum of Square Numbers
DescriptionExample 1Example 2Solution 1(C++)class Solution {public: bool judgeSquareSum(int c) { for(int i=0;i<=sqrt(c);i++){ int j=c-i*i; if(sq...
2018-02-25 18:32:56 351
原创 LeetCode- 507. Perfect Number
DescriptionExampleNoteSolution 1(C++)class Solution {public: bool checkPerfectNumber(int num) { int a=2, b=num, sum=num; while(a<sqrt(num)){ i...
2018-02-23 16:10:43 131
原创 LeetCode-67. Add Binary
DescriptionExampleSolution 1(C++)class Solution {public: string addBinary(string a, string b) { string result; int carry=0,loc=0,sum=0; int lena=a.size(),l...
2018-02-22 18:18:41 109
原创 LeetCode-9. Palindrome Number
DescriptionSome HintsSolution 1(C++)class Solution {public: bool isPalindrome(int x) { if(x<0||(x!=0 && x%10==0)) return false; int y=0; while(x&g...
2018-02-12 18:30:57 151
原创 LeetCode-441. Arranging Coins
DescriptionExample 1Example 2Solution 1(C++)class Solution {public: int arrangeCoins(int n) { int digit=1; int count=0; while(n >= 0){ n -= ...
2018-02-12 16:12:15 176
原创 Sublime Text 3- 2018/2/1用激活码
写在前面这个类别算是开了一个新坑了。其实只是觉得网页开发有点意思,就想利用一些课余时间学点,也算是践行一下“20:80”原则了。那么,这篇博客内容很简单,就是记录一下Sublime Text 3的激活码。懒得下次再找了。激活码以下内容全部复制就好了。—– BEGIN LICENSE —– TwitterInc 200 User License EA7E-890007 1
2018-02-01 17:17:03 33048 7
原创 LeetCode-172. Factorial Trailing Zeroes
DescriptionNoteSolution 1(C++)class Solution {public: int trailingZeroes(int n) { int res=0; long i=5; while(n/i >= 1){ res+= n/i;
2018-02-01 16:10:37 122
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人