- 博客(8)
- 收藏
- 关注
原创 LeetCode : Rotate Array
Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].class Solution {public: void rotate(vector<int>& nu
2017-05-07 00:34:06 219
原创 LeetCode : Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321class Solution {public: int reverse(int x) { int res = 0; while (x != 0) { if
2017-05-07 00:31:46 319
原创 LeetCode : First Bad Version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the
2017-05-07 00:25:31 224
原创 LeetCode:Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example:1 -> A2 -> B3 -> C...26 -> Z27 -> AA28 -> AB class Solution { public: string conve
2017-05-07 00:17:47 311
原创 LeetCode :Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car” is not a palin
2017-05-04 00:10:50 220
原创 LeetCode :Count Primes
Description:Count the number of prime numbers less than a non-negative number, n.class Solution {public: int countPrimes(int n) { int count = 0; int *a = new int[n](); if(n
2017-05-03 14:26:53 181
原创 LeetCode : Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.class Solution {public: int mySqrt(int x) { long r = x; while (r*r > x) r = (r + x/r) / 2; ret
2017-05-02 23:15:54 312
原创 LeetCode : Third Maximum Number
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1: Input: [3, 2, 1]Outp
2017-05-01 23:29:37 283
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人