码迷,mamicode.com
首页 >  
搜索关键字:reverse integer    ( 19410个结果
[leetcode]_Roman to Integer
题目:给定一个罗马数字串,转换为一个整数。一开始没理解,以为是string to int。后来理解:罗马数字与阿拉伯数字的映射关系,见下图:至此,题目的意思才掌握明白,用程序模拟这张表。无可置否,需要将这张表的映射关系存进一个map中,对输入的string查找map中的映射关系。先贴上代码:(注:s...
分类:其他好文   时间:2014-05-19 21:15:15    阅读次数:295
Integer做WeakHashMap的Key应注意的问题
WeakHashMap使用弱引用来作为Map的Key,利用虚拟机的垃圾回收机制能自动释放Map中没有被使用的条目。但是WeakHashMap释放条目是有条件的:首先条目的Key在系统中没有强引用指向;另外,条目的释放是在垃圾回收之后第一次访问这个WeakHashMap时完成的。 而当我们想...
分类:其他好文   时间:2014-05-19 21:13:21    阅读次数:314
LeetCode:Evaluate Reverse Polish Notation
题意:            Evaluate the value of an arithmetic expression in Reverse Polish Notation.        Valid operators are +, -, *, /. Each operand may be an integer or another expression.        So...
分类:其他好文   时间:2014-05-18 08:09:15    阅读次数:190
Java学习笔记_18_字符串、包装类、原始数据类剪得转换
18. 字符串、包装类、原始数据类剪得转换:  各个转换如下:  1>String 转换成Integer:   Integer integer = new Integer(“string”);或   Integer Integer = Integer.valueOf(String);   注:String必须是数字字符串,如:”1232“。  2>Integer 转换成String:...
分类:编程语言   时间:2014-05-18 07:40:29    阅读次数:240
Leetcode | Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then le...
分类:其他好文   时间:2014-05-18 01:53:53    阅读次数:331
Python sorted
sorted函数:iterable:是可迭代类型;cmp:用于比较的函数,比较什么由key决定,有默认值,迭代集合中的一项;key:用列表元素的某个属性和函数进行作为关键字,有默认值,迭代集合中的一项;reverse:排序规则. reverse = True 或者 reverse = False,有...
分类:编程语言   时间:2014-05-17 23:36:24    阅读次数:511
oracle 数组 array
一维数组示例如下:--Createdon2014-5-15byADMINISTRATOR DECLARE TYPEArr1ISVARRAY(10)OFNUMBER; Tab_1Arr1; TYPEArr2ISTABLEOFNUMBERINDEXBYBINARY_INTEGER; Tab_2Arr2; BEGIN --Teststatementshere Tab_1:=Arr1(1,3,4,6,3,2,8,5); FORaIN1..Tab_1.CountLOOP Dbms_Output.Put..
分类:数据库   时间:2014-05-16 02:28:48    阅读次数:371
LeetCode 012 Integer to Roman
【题目】 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 【题意】 给定一个整数,将其表示成罗马数字 【思路】 罗马数字中只使用如下七个基值字母:M,D,C,L,X,V,I,分别用来表示1000、500、100、50、10、5、1。 罗马数组数规则: 基本数字Ⅰ、X 、C 中的任何一个,自身连用构成数目,或者放在大数的右边连用...
分类:其他好文   时间:2014-05-16 01:46:55    阅读次数:312
[leetcode]_Palindrome Number
判断integer是否为回文串(负数全部不为回文串)思路很直接,提取出integer中的每一位,一头一尾进行比较是否相同。一次AC , 直接上代码:public boolean isPalindrome(int x) { if(x = 0 && x 0){ ...
分类:其他好文   时间:2014-05-16 00:24:44    阅读次数:386
【LeetCode】- String to Integer (字符串转成整形)
[ 问题: ] Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this...
分类:其他好文   时间:2014-05-15 23:34:05    阅读次数:353
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!