1. Question确定一个数是否是回文数。要求不使用额外空间。Determine whether an integer is a palindrome. Do this without extra space.2. Solution如果是负数,就不是回文数。2.1 reverse integer...
分类:
其他好文 时间:
2015-06-23 23:04:49
阅读次数:
132
1. Question将字符串转换为整数,考虑各种输入情况:空格处理:开头空格省略有效数字:从第一个非空格字符开始的是+、-或数字,直到下一个非数字字符结束。加号处理:开头加号省略空串处理溢出处理无效数字处理Implement atoi to convert a string to an integ...
分类:
其他好文 时间:
2015-06-23 23:01:58
阅读次数:
197
1. Question给定整数,将其转化为罗马数。输入在1到3999之间。罗马数字的几个基本特点:I:1, V:5, X:10, L:50, C:100, D:500, M:1000相加:数字连写、小的数字在大的数字右边相减:小的数字在大的数字左边罗马数字的限制特点:数字连写仅限I, X, C(即1...
分类:
其他好文 时间:
2015-06-23 22:58:12
阅读次数:
125
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
基本思...
分类:
其他好文 时间:
2015-06-23 21:44:33
阅读次数:
125
1. Question反转一个整数的数位(注意溢出情况)Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -3212. Solution2.1 整除取余法 1 public cla...
分类:
其他好文 时间:
2015-06-23 21:32:58
阅读次数:
100
题目:判断一个数是不是回文数Determine whether an integer is a palindrome. Do this without extra space.思路:借助上一道求整数逆序的思路,判断逆序后的数和原数是否相等就行。要注意,负数都不是回文数11506 / 11506 te...
分类:
其他好文 时间:
2015-06-23 19:48:42
阅读次数:
111
1 如何串 String 转换成整数 int?A. 有两种方法:1). int i = Integer.parseInt([String]); 或i = Integer.parseInt([String],[int radix]);2). int i = Integer.valueOf(my_str...
分类:
编程语言 时间:
2015-06-23 19:40:40
阅读次数:
123
7 Reverse Integer链接:https://leetcode.com/problems/reverse-integer/
问题描述:
Reverse digits of an integer.Example1: x = 123, return 321
Example2: x = -123, return -321click to show spoilers.Have you th...
分类:
其他好文 时间:
2015-06-23 18:06:57
阅读次数:
90
class Solution:
# @param {integer[]} nums
# @return {integer}
def firstMissingPositive(self, nums):
Length = len(nums)
for i in range(Length):
while nums[i] != ...
分类:
其他好文 时间:
2015-06-23 17:50:39
阅读次数:
100
---摘自PHP: 类型 - Manual---PHP 在变量定义中不需要(或不支持)明确的类型定义;变量类型是根据使用该变量的上下文所决定的。也就是说,如果把一个 string 值赋给变量 $var,$var 就成了一个 string。如果又把一个integer 赋给 $var,那它就成了一个in...
分类:
Web程序 时间:
2015-06-23 17:24:45
阅读次数:
163