摘要: Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating,... 阅读全文
posted @ 2015-02-08 23:30 Vae永Silence 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 ->... 阅读全文
posted @ 2015-02-08 23:28 Vae永Silence 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the arr... 阅读全文
posted @ 2015-02-08 23:26 Vae永Silence 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Related to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A ... 阅读全文
posted @ 2015-02-08 23:24 Vae永Silence 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.给定一个整数n,返回n!(n的阶乘)数字中的后缀0的个数。... 阅读全文
posted @ 2015-02-08 23:22 Vae永Silence 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next... 阅读全文
posted @ 2015-02-08 23:17 Vae永Silence 阅读(106) 评论(0) 推荐(0) 编辑
摘要: The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a... 阅读全文
posted @ 2015-02-08 23:13 Vae永Silence 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 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 num... 阅读全文
posted @ 2015-02-08 23:03 Vae永Silence 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 找到最多含有两个不同字符的子串的最长长度。例如:eoeabc,最长的是eoe为3,其他都为2.例如:string s="aqaqedadcdccd";使用一个map fmap记录每个字符出现的个数,详解在程序中注释。int lengthOfLongestSubstringTwoDistinct(st... 阅读全文
posted @ 2015-02-08 22:49 Vae永Silence 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 判断两个字符串的编辑距离是不是1.两个字符串距离是1的可能性:1)两个字符串长度相等:s="abc",t="aec";2)两个字符串长度相差1(两种情况):s="abc",t="abce";或s="abc",t="aebc";bool isOneEditDistance(string s, stri... 阅读全文
posted @ 2015-02-08 22:48 Vae永Silence 阅读(162) 评论(0) 推荐(0) 编辑