随笔分类 -  LeetCode

摘要:题目描述:(链接)Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary t... 阅读全文
posted @ 2015-11-29 14:17 skycore 阅读(150) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[... 阅读全文
posted @ 2015-11-22 17:21 skycore 阅读(145) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,... 阅读全文
posted @ 2015-11-22 16:55 skycore 阅读(199) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1... 阅读全文
posted @ 2015-11-22 16:41 skycore 阅读(136) 评论(0) 推荐(0)
摘要:题目解析:(链接)Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in t... 阅读全文
posted @ 2015-11-22 16:17 skycore 阅读(126) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is ... 阅读全文
posted @ 2015-11-20 11:45 skycore 阅读(153) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", th... 阅读全文
posted @ 2015-11-17 17:54 skycore 阅读(148) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show c... 阅读全文
posted @ 2015-11-17 14:43 skycore 阅读(152) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurren... 阅读全文
posted @ 2015-11-14 22:36 skycore 阅读(175) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.解题思路: 1 class Solution { 2 public: ... 阅读全文
posted @ 2015-11-12 18:28 skycore 阅读(167) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.解题思路: 1 class Solution { 2 public: ... 阅读全文
posted @ 2015-11-12 18:15 skycore 阅读(131) 评论(0) 推荐(0)
摘要:题目描述:(链接)Write a function to find the longest common prefix string amongst an array of strings.解题思路:两两比较。 1 class Solution { 2 public: 3 string lo... 阅读全文
posted @ 2015-11-12 10:22 skycore 阅读(141) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the... 阅读全文
posted @ 2015-11-12 10:09 skycore 阅读(150) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that... 阅读全文
posted @ 2015-11-12 09:55 skycore 阅读(118) 评论(0) 推荐(0)
摘要:题目描述:(链接)The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read ... 阅读全文
posted @ 2015-11-11 22:42 skycore 阅读(164) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a ca... 阅读全文
posted @ 2015-11-09 23:27 skycore 阅读(170) 评论(0) 推荐(0)
摘要:题目描述:(链接)Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2... 阅读全文
posted @ 2015-11-08 22:23 skycore 阅读(126) 评论(0) 推荐(0)
摘要:题目描述:(链接)Given a singly linked list, determine if it is a palindrome.解题思路:使用快慢指针,找到链表的中心点,然后逆序后一半链表,最后再一一比较! 1 /** 2 * Definition for singly-linked l... 阅读全文
posted @ 2015-11-07 23:54 skycore 阅读(171) 评论(0) 推荐(0)
摘要:题目描述:(链接)Determine whether an integer is a palindrome. Do this without extra space.解题思路:分离出首位,末位,分别比较! 1 class Solution { 2 public: 3 bool isPalin... 阅读全文
posted @ 2015-11-07 23:12 skycore 阅读(183) 评论(0) 推荐(0)
摘要:题目描述:(链接)Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.... 阅读全文
posted @ 2015-11-05 23:22 skycore 阅读(123) 评论(0) 推荐(0)