python中的int函数可以将数字或字符串转换为整型数字类型,具体功能就不提了最近发现一个问题,对于字符串'1.1'之类的,int转换的时候会报异常,这是为什么,个人感觉直接转换成1不就行了,干嘛还不能转换了>>> int('1.1')Traceback (most recent call las...
分类:
编程语言 时间:
2015-06-04 19:19:32
阅读次数:
232
DescriptionGiven a positive integer N, you should output the most right digit of N^N. InputThe input contains several test cases. The first line of th...
分类:
Web程序 时间:
2015-06-04 18:50:26
阅读次数:
160
Read the HumanitiesKeith BraithwaiteiN ALL BUT THE SMALLEST DEVELOPMENT PROjECT, people work with people. In all but the most abstracted field of research, people write software for people to support t...
分类:
其他好文 时间:
2015-06-04 11:55:43
阅读次数:
115
Problems: Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your func...
分类:
其他好文 时间:
2015-06-04 11:30:48
阅读次数:
101
//通过唯一的key找到对应的value(键 值)//不可变//通过索引找到内容//也是只能放OC对象,不能放基本数据类型和空值#pragma mark create dictionaryvoid dictCreate(){//most commom used +NSdictionary *dict...
分类:
其他好文 时间:
2015-06-03 17:20:35
阅读次数:
128
try..except我们尝试读取用户的一段输入。按Ctrl-d,看一下会发生什么。>>> s = raw_input('Enter something --> ')Enter something --> Traceback (most recent call last):File "", line...
分类:
其他好文 时间:
2015-06-03 11:19:09
阅读次数:
155
This is a fundamental and yet classic problem. I share my three solutions here:Iterative solution using stack ---O(n)time andO(n)space;Recursive solut...
分类:
其他好文 时间:
2015-06-03 00:54:17
阅读次数:
101
This is a fundamental and yet classic problem. I share my three solutions here:Iterative solution using stack ---O(n)time andO(n)space;Recursive solut...
分类:
其他好文 时间:
2015-06-03 00:49:25
阅读次数:
132
This is a fundamental and yet classic problem. I share my three solutions here:Iterative solution using stack ---O(n)time andO(n)space;Recursive solut...
分类:
其他好文 时间:
2015-06-03 00:46:35
阅读次数:
131
Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.直接使用循...
分类:
其他好文 时间:
2015-06-02 17:54:07
阅读次数:
87