
算法
文章平均质量分 64
大师兄0612
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Leetcode 343(Integer Break非动态规划求解)
问题 Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For example, given n = 2,原创 2016-04-20 10:27:52 · 664 阅读 · 0 评论 -
Leetcode 137: (Single Number II)
Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without us原创 2016-04-13 20:20:20 · 377 阅读 · 0 评论 -
Leetcode 142: Linked List Cycle II & Leetcode 287: Find the Duplicate Number
Leetcode 142: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. 解题思路:设置两个指针,一个快(fp), 一个慢(sp)。fp每次走两步,速度是2v2v,sp每原创 2016-04-13 13:48:55 · 340 阅读 · 0 评论 -
Leetcode 264(Ugly Number II)
QuestionWrite a program to find the nthn^{th} ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the原创 2015-08-19 13:31:36 · 851 阅读 · 0 评论 -
LeetCode 190(Reverse Bits)
QuestionReverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110原创 2015-08-18 10:51:01 · 707 阅读 · 0 评论 -
Leetcode201(Bitwise AND of Numbers Range)
QuestionGiven a range [m,n][m, n] where 0<=m<=n<=21474836470 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.For example, given the range [5,7][5, 7], you should原创 2015-08-16 23:44:26 · 442 阅读 · 0 评论 -
Leetcode 134(Gas Station)
QuestionThere are N gas stations along a circular route, where the amount of gas at station ii is gas[i]gas[i].原创 2015-07-29 12:54:32 · 461 阅读 · 0 评论 -
求解twitter面试题(墙壁装水问题)
看见twitter上一道面试题,题目是这样的,试着做了一下 “在这个图片里我们有不同高度的墙。这个图片由一个整数数组所代表,数组中每个数是墙的高度。上边的图可以表示为数组[2,5,1,2,3,4,7,7,6]” “假如开始下雨了,那么墙之间的水坑能够装多少水呢?” 思路分析: 1. 找出该数组最大的元素(row); 2. 将该数组以该最原创 2015-02-04 15:07:02 · 1144 阅读 · 0 评论 -
300. Longest Increasing Subsequence
Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 101], ther原创 2016-08-23 17:59:27 · 327 阅读 · 0 评论