LeetCode
文章平均质量分 52
陈浅墨
这个作者很懒,什么都没留下…
展开
-
338. Counting Bits
Problem descriptionGiven a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Exam原创 2016-08-16 17:24:42 · 1083 阅读 · 0 评论 -
344. Reverse String
Problem descriptionWrite a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".题目描述:编写一个函数,输入是一个字符串,输出是该字符串的逆序。例子:输入:“Hello”,返原创 2016-08-16 16:52:27 · 410 阅读 · 0 评论 -
371. Sum of Two Integers
Problem descriptionCalculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.题目描述计算两个整数a与b的和,但是你不能使用+、-运算例子原创 2016-08-17 16:07:22 · 794 阅读 · 1 评论 -
136. Single Number
Problem descriptionGiven an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you imple原创 2016-08-18 15:40:47 · 402 阅读 · 0 评论 -
292. Nim Game
Problem descriptionYou are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the l原创 2016-08-18 11:21:21 · 501 阅读 · 0 评论 -
字典序全排列
字典序法的描述如下: 设P是1~n的一个全排列:p=p1p2……pn=p1p2……pj-1pjpj+1……pk-1pkpk+1……pn从排列的右端开始,找出第一个比右边字符小的字符的序号j(j从左端开始计算),即 j=max{i|pi原创 2017-07-10 16:22:25 · 1381 阅读 · 0 评论