摘要: Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thi 阅读全文
posted @ 2017-12-14 16:23 西瓜刀刀刀 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 排序并且改变自身结果: nums.sort() 阅读全文
posted @ 2017-12-14 16:05 西瓜刀刀刀 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected e 阅读全文
posted @ 2017-12-14 16:02 西瓜刀刀刀 阅读(221) 评论(0) 推荐(0) 编辑
摘要: vector<int> v: 最大值: int max = *max_element(v.begin(),v.end()); 最小值: int min = *min_element(v.begin(),v.end()); 阅读全文
posted @ 2017-12-14 11:31 西瓜刀刀刀 阅读(23761) 评论(0) 推荐(1) 编辑
摘要: Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n  阅读全文
posted @ 2017-12-14 11:29 西瓜刀刀刀 阅读(235) 评论(0) 推荐(0) 编辑
摘要: A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128 阅读全文
posted @ 2017-12-14 11:11 西瓜刀刀刀 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 定义一个字符串,求其长度: string str; str.length(); str.size(); 阅读全文
posted @ 2017-12-14 09:41 西瓜刀刀刀 阅读(1842) 评论(0) 推荐(0) 编辑
摘要: 头文件:<string> 转换函数:to_string(); 例如:int n=10; string str=to_string(n) ; 阅读全文
posted @ 2017-12-14 09:32 西瓜刀刀刀 阅读(618) 评论(0) 推荐(0) 编辑
摘要: map函数: 接受一个函数 f 和一个 list 。格式:map( f , L),对L中的每个元素,进行f(x)的一个操作。 例如,对于list [1, 2, 3, 4, 5, 6, 7, 8, 9],如果希望把list的每个元素都作平方,就可以用map()函数: 此时,结果就为:[1, 4, 9, 阅读全文
posted @ 2017-12-13 21:54 西瓜刀刀刀 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 1. capitalize(): 首字母大写,其余全部小写 2. upper() :全转换成大写 3. lower(): 全转换成小写 4. title() :标题首字大写,如 "i love python".title() 输出为:"I love python" 阅读全文
posted @ 2017-12-13 21:48 西瓜刀刀刀 阅读(4153) 评论(0) 推荐(0) 编辑