码迷,mamicode.com
首页 >  
搜索关键字:reverse nodes    ( 8673个结果
Leetcode - Reverse Words
比起POJ弱爆了一题,从后往前扫描一遍,O(n)时间,只要注意各种极端情况即可,不明白通过率为什么只有13%。 #include #include using namespace std; class Solution { public: void reverseWords(string &s) { char* cstr = new char[s.size()+1]; ...
分类:其他好文   时间:2014-06-05 03:45:47    阅读次数:221
反-反汇编 & 混淆 #1: 苹果没有遵循自己制定的Mach-O规范?
通过修改Mach-O文件头来实现反-反汇编...
分类:移动开发   时间:2014-06-04 22:52:23    阅读次数:367
LeetCode:Reorder List
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}, r...
分类:其他好文   时间:2014-06-03 03:12:46    阅读次数:222
LeetCode: Partition List [086]
【题目】 Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. For example, Given 1->4->3-...
分类:其他好文   时间:2014-06-03 00:02:29    阅读次数:270
leetcode -day24 Maximum Depth of Binary Tree & Binary Tree Zigzag Level Order Traversal
1、Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. clas...
分类:其他好文   时间:2014-06-02 23:13:22    阅读次数:290
LeetCode: Reverse Linked List II [092]
【题目】 Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n satisfy the following condition: 1 ≤ m ≤ n ≤ length of list. 【题意】 ...
分类:其他好文   时间:2014-06-01 15:08:34    阅读次数:237
LeetCode: Binary Tree Inorder Traversal [094]
【题目】 Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, could you do it iteratively? confused what "{1,#,2...
分类:其他好文   时间:2014-06-01 13:01:23    阅读次数:279
每日算法之二十二:Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space....
分类:其他好文   时间:2014-06-01 10:41:23    阅读次数:242
每日算法之二十三:Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is...
分类:其他好文   时间:2014-06-01 09:05:42    阅读次数:271
LeetCode: Remove Duplicates from Sorted List II [083]
【题目】 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->3->3->4->4->5, return 1->2->5. Given 1->1->1->2->3, return 2->3. 【题意】 给定一个有序链表,删出其中重复出现的值...
分类:其他好文   时间:2014-05-31 21:14:11    阅读次数:333
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!