随笔分类 -  leetcode

摘要:标题:Plus One通过率:31.1%难度:简单Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the mos... 阅读全文
posted @ 2015-01-16 14:47 pku_smile 阅读(226) 评论(0) 推荐(0)
摘要:标题:Min Stack通过率:15.2%难度:简单Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x o... 阅读全文
posted @ 2015-01-16 14:39 pku_smile 阅读(171) 评论(0) 推荐(0)
摘要:标题:Binary Tree Level Order Traversal通过率:29.9%难度:简单Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, l... 阅读全文
posted @ 2015-01-15 11:27 pku_smile 阅读(136) 评论(0) 推荐(0)
摘要:标题:Compare Version Numbers通过率:14.8%难度:简单Compare two version numbersversion1andversion1.Ifversion1>version2return 1, ifversion1len2 ? len1:len2; 9 ... 阅读全文
posted @ 2015-01-14 11:25 pku_smile 阅读(190) 评论(0) 推荐(0)
摘要:标题:Majority Element通过率:33.8%难度:简单Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋... 阅读全文
posted @ 2015-01-14 11:17 pku_smile 阅读(176) 评论(0) 推荐(0)
摘要:标题:Pascal's Triangle通过率:30.7%难度:简单GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], ... 阅读全文
posted @ 2015-01-14 10:05 pku_smile 阅读(163) 评论(0) 推荐(0)
摘要:标题:Excel Sheet Column Number通过率:39.8%难度:简单Related to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corr... 阅读全文
posted @ 2015-01-14 10:00 pku_smile 阅读(154) 评论(0) 推荐(0)
摘要:这一段一直忙考试,一直没有刷题,今天上来刷三道题感觉生疏起来了。。罪过啊。刷到今天了。。还是没有写算法的感觉,还是写代码太少了。java的用法又忘记了很多。java上手后就要开始写python了,反正现在就是没有写代码的感觉。题目:Longest Common Prefix通过率:26.5%难度:简... 阅读全文
posted @ 2015-01-13 11:54 pku_smile 阅读(176) 评论(0) 推荐(0)
摘要:标题:Merge Sorted Array通过率:31.1%难度:简单Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough s... 阅读全文
posted @ 2014-12-21 22:31 pku_smile 阅读(150) 评论(0) 推荐(0)
摘要:标题:Symmetric Tree通过率:31.1%难度:简单Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary ... 阅读全文
posted @ 2014-12-21 21:57 pku_smile 阅读(172) 评论(0) 推荐(0)
摘要:标题:Remove Duplicates from Sorted Array通过率:31.9%难度简单Given a sorted array, remove the duplicates in place such that each element appear onlyonceand retu... 阅读全文
posted @ 2014-12-18 13:54 pku_smile 阅读(137) 评论(0) 推荐(0)
摘要:标题:Balanced Binary Tree通过率:32.3%难度:简单Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is define... 阅读全文
posted @ 2014-12-18 13:45 pku_smile 阅读(143) 评论(0) 推荐(0)
摘要:标题:Maximum Depth of Binary Tree通过率:44.2%难度:简单Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest pa... 阅读全文
posted @ 2014-12-18 13:34 pku_smile 阅读(166) 评论(0) 推荐(0)
摘要:标题:Remove Element通过率:32.6%难度:简单Given an array and a value, remove all instances of that value in place and return the new length.The order of elements... 阅读全文
posted @ 2014-12-17 11:05 pku_smile 阅读(93) 评论(0) 推荐(0)
摘要:标题:Merge Two Sorted Lists通过率:33.1%难度:简单Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the... 阅读全文
posted @ 2014-12-17 10:53 pku_smile 阅读(149) 评论(0) 推荐(0)
摘要:标题:Climbing Stairs通过率:34%难度:简单You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how ma... 阅读全文
posted @ 2014-12-17 10:40 pku_smile 阅读(113) 评论(0) 推荐(0)
摘要:标题:Remove Duplicates from Sorted List通过率:34.5难度:简单Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example... 阅读全文
posted @ 2014-12-15 21:58 pku_smile 阅读(164) 评论(0) 推荐(0)
摘要:标题:Roman to Integer通过率:34.1%难度:简单Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.这个题整体不是很难,就... 阅读全文
posted @ 2014-12-15 21:37 pku_smile 阅读(125) 评论(0) 推荐(0)
摘要:标题:String to Integer (atoi)通过率:13.8难度:简单Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a... 阅读全文
posted @ 2014-12-12 23:09 pku_smile 阅读(133) 评论(0) 推荐(0)
摘要:标题:Reverse Integer正确率:34.8%难度简单Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Have you thought about this?Here... 阅读全文
posted @ 2014-12-12 22:56 pku_smile 阅读(129) 评论(0) 推荐(0)