2015年3月19日

摘要: 1 题目Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bi... 阅读全文
posted @ 2015-03-19 15:44 聆听V风声 阅读(160) 评论(0) 推荐(0) 编辑

2015年3月10日

摘要: 1 题目Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't... 阅读全文
posted @ 2015-03-10 22:37 聆听V风声 阅读(144) 评论(0) 推荐(0) 编辑

2015年3月8日

摘要: 1 题目Implement pow(x,n).Hide TagsMathBinary Search2 思路一开始想的是使用二分递归调用。要考虑n为负数的情况。时间是O(log(n)),比调用pow(x,n-1)要快很多。后来看了别人的思路,有一种bit位操作的,空间复杂度O(1)的算法。3 代码 ... 阅读全文
posted @ 2015-03-08 09:16 聆听V风声 阅读(155) 评论(0) 推荐(0) 编辑

2015年3月6日

摘要: 1 题目Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are... 阅读全文
posted @ 2015-03-06 22:28 聆听V风声 阅读(158) 评论(0) 推荐(0) 编辑
 
摘要: 1 前提已经配置好了java的环境,课上要使用andriod开发。2 步骤2.1 eclipse2.1.1先安装adt,adt是一个在eclipse中开发andriod的插件。由于墙,我是从其他地方下下来,本地安装的。2.1.2安装sdk,我已经在hosts文件中加了谷歌的那个域名,今天可以更新了,... 阅读全文
posted @ 2015-03-06 18:42 聆听V风声 阅读(203) 评论(0) 推荐(0) 编辑

2015年3月4日

摘要: 1 题目Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1 fversion2) return 1; else if(fversion1 < ... 阅读全文
posted @ 2015-03-04 21:23 聆听V风声 阅读(177) 评论(0) 推荐(0) 编辑

2015年3月2日

摘要: 1题目Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word ... 阅读全文
posted @ 2015-03-02 20:36 聆听V风声 阅读(112) 评论(0) 推荐(0) 编辑
 
摘要: 1 题目Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C ... 阅读全文
posted @ 2015-03-02 19:42 聆听V风声 阅读(104) 评论(0) 推荐(0) 编辑
 
摘要: 1 题目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-02 11:52 聆听V风声 阅读(206) 评论(0) 推荐(0) 编辑

2015年3月1日

摘要: 1 题目All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful... 阅读全文
posted @ 2015-03-01 16:20 聆听V风声 阅读(199) 评论(0) 推荐(0) 编辑