leetcode记录
文章平均质量分 85
redstraw
一个要奋起图强的小白!
展开
-
Leetcode: Factorial Trailing Zeroes
第一天开始刷题,努力脱离小白路线,希望可以坚持!这道题目开始都没有看懂题意,然后努力找翻译,结果就直接看到别人答案了,囧~ 题目意思是:求n!的末尾的0的个数; 解法参考:http://www.tuicool.com/articles/RZZnQf 大致思路是: 末尾的0是由1*2*3*...*n式子中的"2*5"产生,因此需要判断n!中包含多少个2,5因子;对原创 2015-01-14 17:12:05 · 989 阅读 · 0 评论 -
LeetCode:Minimum Depth of Binary Tree
LeetCode第二话,其实中间也写了其他题,但是较为简单,就不赘述了。这道题,一上来,又理解错了,一直以为是用广度优先来一层一层的搜索哪个节点没有两个子节点。结果一测试,当只有两个节点时,结果居然为2,感觉太不可思议了,所以赶紧跑去看看人家怎么理解题目的。就看到这篇http://blog.csdn.net/andrewseu/article/details/28595541。 题目为:Give原创 2015-01-14 15:49:34 · 379 阅读 · 0 评论 -
Leetcode:Binary Search Tree Iterator
最近真是各种私事,也顺便给自己懒惰的机会了。今天开始要继续坚持! 看了这道题,顿时觉得自己太挫,Binary Search Tree居然不知道什么意思。赶紧百度搜索了下。下面这篇文章其实就挺简单易懂的。不知道的童鞋学习下。http://www.cnblogs.com/elaron/archive/2013/04/11/3015155.htm。 Binary Search Tree,即二原创 2015-02-10 00:16:24 · 374 阅读 · 0 评论 -
Leetcode:Repeated DNA Sequences
开始看到题目,觉得就是直接从第一个子字符串开始遍历,并存储在List中,如果某个子字符串出现两次,就将其添加到结果列表中。结果TLE(Time Limited Exceeded)了。代码如下: public class Solution { public List findRepeatedDnaSequences(String s) { List res原创 2015-02-12 01:10:21 · 2455 阅读 · 0 评论 -
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 resu转载 2015-02-13 17:41:09 · 272 阅读 · 0 评论 -
leetcode:Fraction to Recurring Decimal
原文地址:http://blog.csdn.net/ljiabin/article/details/42025037 【题目】 Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the转载 2015-02-26 23:21:57 · 350 阅读 · 0 评论 -
leetcode:Longest Palindromic Substring
这道题目真是弄了很久啊,然后查了好多相关知识,哎,貌似一直很焦躁,我这是怎么了,不能继续这么下去啊,加油! 英文原文地址:http://leetcode.com/2011/11/longest-palindromic-substring-part-i.html 1.回文简介 首先,介绍下回文的含义。回文就是对称的序列,无论从前往后读,还是从后往前读,都是一样的。例如,“a翻译 2015-03-03 00:23:41 · 566 阅读 · 0 评论