Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i... Read More
posted @ 2014-08-21 23:24
Xylophone
Views(144)
Comments(0)
Diggs(0)
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... Read More
posted @ 2014-08-21 21:14
Xylophone
Views(162)
Comments(0)
Diggs(0)
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.用map记录出现的string的下标,避免了再次遍历。class Solu... Read More
posted @ 2014-08-21 15:33
Xylophone
Views(135)
Comments(0)
Diggs(0)
Implement pow(x, n).刚开始没想到,后来看remlost的博客才写出来,代码很简练:class Solution {public: double pow(double x, int n) { if(n<0) return 1/power(x... Read More
posted @ 2014-08-21 09:54
Xylophone
Views(222)
Comments(0)
Diggs(0)
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all d... Read More
posted @ 2014-08-21 09:31
Xylophone
Views(133)
Comments(0)
Diggs(0)
The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11. 11 is read of... Read More
posted @ 2014-08-21 00:14
Xylophone
Views(111)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号