随笔分类 -  [LeetCode]

摘要:Problem:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Analysis:This problem actually requi... 阅读全文
posted @ 2015-09-02 01:04 airforce 阅读(130) 评论(0) 推荐(0)
摘要:Problem:Implement pow(x,n).Analysis:This problem inherently is very easy and simple.Don't try to treat a problem as difficult problem, even the myster... 阅读全文
posted @ 2015-09-01 23:52 airforce 阅读(593) 评论(0) 推荐(1)
摘要:Problem:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorte... 阅读全文
posted @ 2015-09-01 22:18 airforce 阅读(175) 评论(0) 推荐(0)
摘要:Problem:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums... 阅读全文
posted @ 2015-09-01 11:19 airforce 阅读(135) 评论(0) 推荐(0)
摘要:Problem:Related to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For exampl... 阅读全文
posted @ 2015-09-01 10:07 airforce 阅读(145) 评论(0) 推荐(0)
摘要:Problem:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is l... 阅读全文
posted @ 2015-09-01 09:20 airforce 阅读(216) 评论(0) 推荐(0)
摘要:Problem:Write a program to find then-th ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For example,1, 2, 3, 4,... 阅读全文
posted @ 2015-09-01 07:45 airforce 阅读(277) 评论(0) 推荐(0)
摘要:Problem:Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. F... 阅读全文
posted @ 2015-09-01 04:24 airforce 阅读(142) 评论(0) 推荐(0)
摘要:Problem:Description:Count the number of prime numbers less than a non-negative number,n.Analysis:The idea to test if a number is prime.Reference:https... 阅读全文
posted @ 2015-09-01 03:00 airforce 阅读(141) 评论(0) 推荐(0)
摘要:Problem:Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.Credits:Special thank... 阅读全文
posted @ 2015-08-31 22:23 airforce 阅读(187) 评论(0) 推荐(0)
摘要:Problem:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 3... 阅读全文
posted @ 2015-08-31 12:31 airforce 阅读(178) 评论(0) 推荐(0)
摘要:Problem:Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word o... 阅读全文
posted @ 2015-08-31 10:43 airforce 阅读(216) 评论(0) 推荐(0)
摘要:Problem:Given two words (startandend), and a dictionary, find all shortest transformation sequence(s) fromstarttoend, such that:Only one letter can be... 阅读全文
posted @ 2015-08-30 12:07 airforce 阅读(161) 评论(0) 推荐(0)
摘要:Problem:Given two words (beginWordandendWord), and a dictionary, find the length of shortest transformation sequence frombeginWordtoendWord, such that... 阅读全文
posted @ 2015-08-30 11:03 airforce 阅读(199) 评论(0) 推荐(0)
摘要:Problem:Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner a... 阅读全文
posted @ 2015-08-29 08:48 airforce 阅读(178) 评论(0) 推荐(0)
摘要:Problem:Implement a trie withinsert,search, andstartsWithmethods.Note:You may assume that all inputs are consist of lowercase lettersa-z.Analysis:This... 阅读全文
posted @ 2015-08-29 01:26 airforce 阅读(224) 评论(0) 推荐(0)
摘要:Problem:Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequential... 阅读全文
posted @ 2015-08-28 23:55 airforce 阅读(213) 评论(0) 推荐(0)
摘要:Problem:There are a total ofncourses you have to take, labeled from0ton - 1.Some courses may have prerequisites, for example to take course 0 you have... 阅读全文
posted @ 2015-08-28 04:40 airforce 阅读(356) 评论(0) 推荐(0)
摘要:Problem:There are a total ofncourses you have to take, labeled from0ton - 1.Some courses may have prerequisites, for example to take course 0 you have... 阅读全文
posted @ 2015-08-28 04:04 airforce 阅读(220) 评论(0) 推荐(0)
摘要:Problem:Given an array of numbersnums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two el... 阅读全文
posted @ 2015-08-27 23:47 airforce 阅读(282) 评论(0) 推荐(0)