摘要: 题目描述:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the t... 阅读全文
posted @ 2015-03-19 17:12 SevenForever 阅读(381) 评论(0) 推荐(0)
摘要: 题目描述:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), re... 阅读全文
posted @ 2015-03-19 16:31 SevenForever 阅读(130) 评论(0) 推荐(0)
摘要: 题目描述Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321数字x不停对10取整,变量result*10加余数,直至数字x==0,那么result就是x的翻转几个特殊情况:1.负... 阅读全文
posted @ 2015-03-19 16:26 SevenForever 阅读(113) 评论(0) 推荐(0)
摘要: 题目描述:Determine whether an integer is a palindrome. Do this without extra space.思路:对数字不停对10取余,并将余数乘10累加,比较剩下的数字与余数的大小,直至相等或者数字对10取余后相等,返回true,否则返回false... 阅读全文
posted @ 2015-03-19 16:23 SevenForever 阅读(121) 评论(0) 推荐(0)
摘要: 题目描述:Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].Note:Try to... 阅读全文
posted @ 2015-03-19 11:30 SevenForever 阅读(468) 评论(0) 推荐(0)