2017年3月15日

LeetCode : Ugly Number

摘要: 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.... 阅读全文

posted @ 2017-03-15 17:20 gechen 阅读(86) 评论(0) 推荐(0) 编辑

LeetCode : Number of 1 Bits

摘要: 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... 阅读全文

posted @ 2017-03-15 16:32 gechen 阅读(76) 评论(0) 推荐(0) 编辑

LeetCode : Path Sum III

摘要: Find the number of paths that sum to a given value.The path does not need to start or end at the root or a leaf, but it must go downwards (tr... 阅读全文

posted @ 2017-03-15 16:14 gechen 阅读(80) 评论(0) 推荐(0) 编辑

LeetCode : Maximum Subarray

摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3... 阅读全文

posted @ 2017-03-15 11:19 gechen 阅读(56) 评论(0) 推荐(0) 编辑

LeetCode : Search Insert Position

摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inser... 阅读全文

posted @ 2017-03-15 10:50 gechen 阅读(59) 评论(0) 推荐(0) 编辑

2017年3月14日

LeetCode : Power of Two

摘要: Given an integer, write a function to determine if it is a power of two.class Solution {public: bool isPowerOfTwo(int n) { if(n<1) ... 阅读全文

posted @ 2017-03-14 10:58 gechen 阅读(78) 评论(0) 推荐(0) 编辑

2017年3月13日

LeetCode : Power of Three

摘要: Given an integer, write a function to determine if it is a power of three.Follow up: Could you do it without using any loop / recursion?Credi... 阅读全文

posted @ 2017-03-13 23:26 gechen 阅读(72) 评论(0) 推荐(0) 编辑

导航