随笔分类 -  LeetCode

LeetCode237-Delete Node in a Linked List
摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 ->... 阅读全文

posted @ 2015-11-10 10:51 露台上对望 阅读(465) 评论(0) 推荐(0)

LeetCode104-Maximum Depth of Binary Tree
摘要:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文

posted @ 2015-11-09 15:19 露台上对望 阅读(128) 评论(0) 推荐(0)

LeetCode 204-Count Primes
摘要:Description:Count the number of prime numbers less than a non-negative number,n.描述:计算小于n的质数的个数 这里用到的方法是埃拉托色尼筛选法(Sieve of Eratosthenes),思路大致为:对于1~n-1这... 阅读全文

posted @ 2015-10-09 15:29 露台上对望 阅读(196) 评论(0) 推荐(0)

LeetCode 263-Ugly Number
摘要: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. For examp... 阅读全文

posted @ 2015-10-08 21:01 露台上对望 阅读(201) 评论(0) 推荐(0)

LeetCode 258-Add Digits
摘要:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... 阅读全文

posted @ 2015-10-06 16:44 露台上对望 阅读(214) 评论(0) 推荐(0)

导航