随笔分类 -  LeetCode

摘要:Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6... 阅读全文
posted @ 2015-07-15 20:17 从此寂静无声 阅读(203) 评论(0) 推荐(0)
摘要: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 is1 -> 2 -> 3 -> ... 阅读全文
posted @ 2015-07-15 19:01 从此寂静无声 阅读(119) 评论(0) 推荐(0)
摘要:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.【罗马数字】1~9: {"I", "II", "III", "IV", "V", "VI... 阅读全文
posted @ 2015-07-12 23:19 从此寂静无声 阅读(150) 评论(0) 推荐(0)
摘要:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2015-07-12 22:02 从此寂静无声 阅读(181) 评论(0) 推荐(0)
摘要:Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ... 阅读全文
posted @ 2015-07-12 17:15 从此寂静无声 阅读(148) 评论(0) 推荐(0)
摘要:Given a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5","7"].class Sol... 阅读全文
posted @ 2015-07-12 14:41 从此寂静无声 阅读(144) 评论(0) 推荐(0)
摘要:Given an integer, write a function to determine if it is a power of two.//初始理解为把数字拆分为两个整数的乘积。。。英语差真操蛋C++:class Solution {public: bool isPowerOfTwo(... 阅读全文
posted @ 2015-07-12 13:54 从此寂静无声 阅读(177) 评论(0) 推荐(0)
摘要:Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa... 阅读全文
posted @ 2015-07-11 19:25 从此寂静无声 阅读(186) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2015-07-11 18:17 从此寂静无声 阅读(152) 评论(0) 推荐(0)
摘要:题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complet... 阅读全文
posted @ 2015-07-11 16:34 从此寂静无声 阅读(138) 评论(0) 推荐(0)