随笔分类 - 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...
阅读全文
摘要:题目描述:(链接)Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[...
阅读全文
摘要:题目描述:(链接)Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,...
阅读全文
摘要:题目描述:(链接)Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1...
阅读全文
摘要:题目解析:(链接)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...
阅读全文
摘要:题目描述:(链接)Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is ...
阅读全文
摘要:题目描述:(链接)Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", th...
阅读全文
摘要:题目描述:(链接)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...
阅读全文
摘要:题目描述:(链接)Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurren...
阅读全文
摘要:题目描述:(链接)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: ...
阅读全文
摘要:题目描述:(链接)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: ...
阅读全文
摘要:题目描述:(链接)Write a function to find the longest common prefix string amongst an array of strings.解题思路:两两比较。 1 class Solution { 2 public: 3 string lo...
阅读全文
摘要:题目描述:(链接)Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the...
阅读全文
摘要:题目描述:(链接)Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that...
阅读全文
摘要:题目描述:(链接)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 ...
阅读全文
摘要:题目描述:(链接)Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a ca...
阅读全文
摘要:题目描述:(链接)Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2...
阅读全文
摘要:题目描述:(链接)Given a singly linked list, determine if it is a palindrome.解题思路:使用快慢指针,找到链表的中心点,然后逆序后一半链表,最后再一一比较! 1 /** 2 * Definition for singly-linked l...
阅读全文
摘要:题目描述:(链接)Determine whether an integer is a palindrome. Do this without extra space.解题思路:分离出首位,末位,分别比较! 1 class Solution { 2 public: 3 bool isPalin...
阅读全文
摘要:题目描述:(链接)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....
阅读全文

浙公网安备 33010602011771号