Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
class Solution {
public:
int reverse(int x) {
int Answer=0;
...
分类:
其他好文 时间:
2014-11-25 12:45:26
阅读次数:
191
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now [1,1,2,...
分类:
其他好文 时间:
2014-11-20 17:07:45
阅读次数:
194
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with...
分类:
其他好文 时间:
2014-11-20 17:07:03
阅读次数:
218
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-11-11 22:56:05
阅读次数:
218
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
class Solution {
public:
int reverse(int x) {
int Answer=0;
...
分类:
其他好文 时间:
2014-11-11 22:53:55
阅读次数:
203
Implement strStr()Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.实现String...
分类:
其他好文 时间:
2014-09-15 00:54:37
阅读次数:
185
Scramble StringGiven a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible...
分类:
其他好文 时间:
2014-09-02 00:17:33
阅读次数:
260
Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:
其他好文 时间:
2014-08-31 18:34:41
阅读次数:
180
Best Time to Buy and Sell Stock IIISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the...
分类:
其他好文 时间:
2014-08-26 19:13:26
阅读次数:
268