码迷,mamicode.com
首页 >  
搜索关键字:reverse nodes    ( 8673个结果
【Linux】字符转换命令col
[root@www ~]# col [-xb]选项与参数:-x :将 tab 键转换成对等的空格键-b :过滤掉所有的控制字符,包括RLF(Reverse Line Feed)和HRF(Halt RLF)范例一:利用 cat -A 显示出所有特殊按键,最后以 col 将 [tab] 转成空白[r.....
分类:系统相关   时间:2014-05-16 19:12:22    阅读次数:349
LeetCode OJ - Evaluate Reverse Polish Notation
题目: Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another e.....
分类:其他好文   时间:2014-05-16 05:56:07    阅读次数:221
LeetCode OJ - Reverse Words in a String
题目: Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the".解题思路: 1、先对字符串进行一次总...
分类:其他好文   时间:2014-05-16 05:44:30    阅读次数:263
Leetcode 树 Binary Tree Zigzag Level Order Traversal
题意:给定一棵二叉树,返回按zigzag层次遍历的结果 思路: 还是跟前面的Binary Tree Level Order Traversal的思路一样 即从上往下按层遍历二叉树,将每一层的节点存放到该层对应的数组中 最后将得到的总数组中奇数层(从0层开始计数)的子数组reverse一下就可以了 复杂度:时间O(n),空间O(n)...
分类:其他好文   时间:2014-05-15 15:15:50    阅读次数:374
Leetcode--Validate Binary Search Tree
Problem Description: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys l...
分类:其他好文   时间:2014-05-15 11:22:21    阅读次数:317
LeetCode-004 Add Two Numbers
【题目】 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Out...
分类:其他好文   时间:2014-05-15 05:13:49    阅读次数:306
Pat(Advanced Level)Practice--1043(Is It a Binary Search Tree)
Pat1043代码 题目描述: A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than t...
分类:其他好文   时间:2014-05-15 05:09:59    阅读次数:351
Leetcode 线性表 Swap Nodes in Pairs
题意:交换给定链表中的相邻节点,但不可以改变链表里的值 如1->2->3->4交换后为2->1->4->3 思路: 按题意中的扫描去改变每两个相邻节点的next指针的指向即可。 小技巧: 因为处理每两个相邻节点的时候,需要一个指针记录它们前一个节点,而头节点前面没有节点, 所以可设置一个dummy节点指向头指针,这样开头的两个节点的处理方式跟其它的相邻节点的处理方式就一样了 复杂度:时间O(n),空间O(1)...
分类:其他好文   时间:2014-05-15 00:16:00    阅读次数:359
LeetCode--Binary Tree Preorder Traversal
Binary Tree Preorder Traversal  Total Accepted: 18022 Total Submissions: 51784My Submissions Given a binary tree, return the preorder traversal of its nodes' values. For example: Given b...
分类:其他好文   时间:2014-05-14 20:43:22    阅读次数:242
LeetCode 007 Reverse Integer
【题目】 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 【题意】 反转int型整数,输出的也是int型的整数 【思路】 如要考虑两种特殊情况: 1. 类似100这样的整数翻转之后为1 2. 翻转之后的值溢出该如何处理, 本题的测试用例中似乎没有给出溢出的情况 ...
分类:其他好文   时间:2014-05-14 20:41:19    阅读次数:244
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!