IncredibleThings

导航

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 28 下一页

2016年7月19日 #

LeetCode-Power of Four

摘要: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num = 5, return false. Follow up: Could you solve it without loo... 阅读全文

posted @ 2016-07-19 03:13 IncredibleThings 阅读(100) 评论(0) 推荐(0) 编辑

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? public class Solution { private static final double ep... 阅读全文

posted @ 2016-07-19 03:05 IncredibleThings 阅读(126) 评论(0) 推荐(0) 编辑

2016年7月16日 #

LeetCode-Largest Number

摘要: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330. Note: The result may be very ... 阅读全文

posted @ 2016-07-16 04:44 IncredibleThings 阅读(138) 评论(0) 推荐(0) 编辑

2016年7月14日 #

LeetCode-Nim Game

摘要: 题目说给我们一堆石子,每次可以拿一个两个或三个,两个人轮流拿,拿到最后一个石子的人获胜,现在给我们一堆石子的个数,问我们能不能赢。那么我们就从最开始分析,由于是我们先拿,那么3个以内(包括3个)的石子,我们直接赢,如果共4个,那么我们一定输,因为不管我们取几个,下一个人一次都能取完。如果共5个,我们 阅读全文

posted @ 2016-07-14 21:56 IncredibleThings 阅读(134) 评论(0) 推荐(0) 编辑

LeetCode-Word Pattern

摘要: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str. Examp... 阅读全文

posted @ 2016-07-14 21:41 IncredibleThings 阅读(111) 评论(0) 推荐(0) 编辑

LeetCode-Move Zeroes

摘要: 题目可以在O(n)时间复杂度内求解 算法步骤: 使用两个"指针"x和y,初始令y = 0 利用x遍历数组nums: 若nums[x]非0,则交换nums[x]与nums[y],并令y+1 阅读全文

posted @ 2016-07-14 05:38 IncredibleThings 阅读(112) 评论(0) 推荐(0) 编辑

2016年7月12日 #

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. For example, 6, 8 are ugly while 14 is not ugly since i... 阅读全文

posted @ 2016-07-12 22:04 IncredibleThings 阅读(127) 评论(0) 推荐(0) 编辑

LeetCode-First Bad Version

摘要: You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on th... 阅读全文

posted @ 2016-07-12 22:02 IncredibleThings 阅读(125) 评论(0) 推荐(0) 编辑

LeetCode-Add Digits

摘要: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one di... 阅读全文

posted @ 2016-07-12 05:07 IncredibleThings 阅读(104) 评论(0) 推荐(0) 编辑

2016年6月1日 #

LeetCode-Valid Anagram

摘要: 二刷: 阅读全文

posted @ 2016-06-01 06:10 IncredibleThings 阅读(137) 评论(0) 推荐(0) 编辑

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 28 下一页