191. Number of 1 Bits(C++)

题目:Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight). For example, the 32...

2017-05-11 19:39:05

阅读数 243

评论数 0

231. Power of Two(C++)

题目:Given an integer, write a function to determine if it is a power of two. 这道题和LeetCode上326题只是换了数字的差别,翻译和具体解析在这里都有介绍 http://blog.csdn.net/ZZLCSDN...

2017-05-10 21:01:45

阅读数 240

评论数 0

326. Power of Three(C++)

题目:Given an integer, write a function to determine if it is a power of three. 给一个整数,判断它是不是3的幂数 Follow up: Could you do it without using any loop ...

2017-05-10 20:48:07

阅读数 277

评论数 0

204. Count Primes(C++)

题目:Description: Count the number of prime numbers less than a non-negative number, n. 找出小于n的所有素数的个数解答:先将小于n的所有数都标记为true,从0开始,对接下来见到的每一个素数(true),使所有...

2017-05-09 14:25:25

阅读数 257

评论数 0

263. Ugly Number(C++)

题目:Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. F...

2017-05-09 13:06:43

阅读数 164

评论数 0

202. Happy Number(C++)

题目:Write an algorithm to determine if a number is “happy”. A happy number is a number defined by the following process: Starting with any positive i...

2017-05-09 12:30:29

阅读数 238

评论数 0

217. Contains Duplicate Add to List(C++)

题目:Given an array of integers(整数), find if the array contains any duplicates(重复). Your function should return true if any value appears at least twic...

2017-05-09 09:56:21

阅读数 154

评论数 0

最长回文子串

零:预备回文串:正着读和倒着读都一样的的字符串。 要求:在一个字符串中找到符合回文串条件的最长的回文子串。 目前学到的有四种方法,按照我认为的理解难度排序: 均附有c++代码 设字符串总长度为len,本文只给出了最长长度的答案ans,如果想要知道最长回文字串是哪一个,只要在设置一个起始值b...

2017-05-08 19:27:23

阅读数 161

评论数 0

提示
确定要删除当前文章?
取消 删除
关闭
关闭