
Math
ljffdream
这个作者很懒,什么都没留下…
展开
-
【Leetcode】Unique Paths
【题目】A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to转载 2015-01-06 17:05:05 · 343 阅读 · 0 评论 -
【leetcode】Count Primes
【题目】Description:Count the number of prime numbers less than a non-negative number, n.Credits:Special thanks to @mithmatt for adding this problem and creating all test cases.Hint:Let's转载 2015-07-21 09:29:39 · 308 阅读 · 0 评论 -
[Leetcode]Power of Two
[题目]Given an integer, write a function to determine if it is a power of two.[思路]这道题的思路还是蛮简单的说,0的时候是false,不可能是2 的倍数。8/2 =4 4/2 =2 2/2 =1。最后肯定是得1。7%2 !=0不能被2整除肯定是不行的。[代码]public class S转载 2015-07-06 21:43:07 · 667 阅读 · 0 评论 -
【Leetcode】String to Integer(ATOI)
【题目】Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possibl转载 2015-07-12 17:03:52 · 395 阅读 · 0 评论 -
【Leetcode】Reverse Integer
【题目】Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Have you thought about this?Here are some good questions to ask before coding. Bonus po转载 2015-07-12 10:38:46 · 382 阅读 · 0 评论 -
【Leetcode】Factorial Trailing Zeroes
【题目】Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Credits:Special thanks to @ts for adding this problem an转载 2015-07-04 22:55:21 · 372 阅读 · 0 评论 -
【Leetcode】Valid Sudoku
【题目】Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A parti转载 2015-07-05 10:37:08 · 381 阅读 · 0 评论 -
[Leetcode]Happy Number
[题目]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 integer, replace the number by the sum of the s转载 2015-07-01 13:29:44 · 318 阅读 · 0 评论 -
【Leetcode】Rectangular Area
【题目】 Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Rectangle Area图片: https:转载 2015-06-28 23:29:14 · 337 阅读 · 0 评论 -
[Leetcode]Basic calculator 1 and 2
[题目]Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers an转载 2015-06-19 10:50:56 · 459 阅读 · 0 评论 -
【Leetcode】Excel Sheet Column Number
【题目】Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3原创 2015-01-03 09:32:06 · 275 阅读 · 0 评论 -
【Leetcode】Excel sheet Column title
【题目】Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB原创 2015-01-03 10:02:07 · 267 阅读 · 0 评论 -
【Leetcode】integer to Roman
【题目】Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.【分析】只要是遵守那个转换规则就好吧。然后就是数学处理。【代码1】private static LinkedHashMap numToRoman原创 2014-12-24 18:58:12 · 279 阅读 · 0 评论 -
【Leetcode】Set matrix zeros
【题目】【思路】My idea is simple: store states of each row in the first of that row, and store states of each column in the first of that column. Because the state of row0 and the state of column0转载 2015-09-01 23:10:47 · 354 阅读 · 0 评论