码迷,mamicode.com
首页 >  
搜索关键字:reverse nodes    ( 8673个结果
Problem Binary Tree Postorder Traversal
Problem Description:Given a binary tree, return thepostordertraversal of its nodes' valuesSolution: 1 public List postorderTraversal(TreeNode root) { ...
分类:其他好文   时间:2014-07-07 16:45:23    阅读次数:177
[Leetcode][Tree][Binary Tree Level Order Traversal ]
树的层次遍历,比较简单,3个题的做法完全一样,只是在特定的地方对结果进行reverse。1、Binary Tree Level Order Traversal/** * Definition for binary tree * struct TreeNode { * int val; * ...
分类:其他好文   时间:2014-07-07 16:39:56    阅读次数:194
Problem Reverse Worlds in a String
Problem Description:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Solution: ...
分类:其他好文   时间:2014-07-07 16:39:19    阅读次数:163
Problem Binary Tree Preorder Traversal
Problem Description:Given a binary tree, return thepreordertraversal of its nodes' values.Solution: 1 public List preorderTraversal(TreeNode root)...
分类:其他好文   时间:2014-07-07 16:34:34    阅读次数:208
LeetCode::Remove Duplicates from Sorted List II [具体分析]
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2-...
分类:其他好文   时间:2014-07-07 16:17:00    阅读次数:139
leetcode - Merge Two Sorted Lists
题目:Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the ...
分类:其他好文   时间:2014-07-07 14:06:19    阅读次数:221
Problem Evaluate Reverse Polish Notation
Problem Description:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integ...
分类:其他好文   时间:2014-06-30 14:32:54    阅读次数:151
LeetCode: Reorder List [143]
【题目】 Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For example, Given {1,2,3,4}, reorder it to {1,4,2,3}. 【题意】 给定一个链表L: L0→L1→…→Ln-1→Ln,对他重新排序成L...
分类:其他好文   时间:2014-06-30 10:11:14    阅读次数:158
LeetCode: Binary Tree Postorder Traversal [145]
【题目】 Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [3,2,1]. Note: Recursive solution is trivial, could you do it iteratively? 【题意】 非递归实现后续遍...
分类:其他好文   时间:2014-06-30 10:10:10    阅读次数:177
LeetCode: Binary Tree Preorder Traversal [144]
【题目】 Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [1,2,3]. Note: Recursive solution is trivial, could you do it iteratively? 【题意】 非递归返回先序遍历...
分类:其他好文   时间:2014-06-30 06:21:18    阅读次数:334
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!