码迷,mamicode.com
首页 >  
搜索关键字:reverse nodes    ( 8673个结果
reverse the string word by word
题目:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".要求:1)首尾有空格的时候,反转后的string要将空...
分类:其他好文   时间:2014-07-16 19:29:54    阅读次数:234
LeetCode--Reverse Words in a String
class Solution {public: void reverseWords(string &s) { int len = s.length(); if(len == 0) return; vector res; ...
分类:其他好文   时间:2014-07-16 18:50:12    阅读次数:161
[cc150] check palindrome of a singly linked list
Problem: Implement a function to check if a singly linked list is a palindrome.思路:最简单的方法是 Reverse and compare.另外一种非常经典的办法是用 Recursive 的思路,把一个list看成这种形...
分类:其他好文   时间:2014-07-16 17:41:23    阅读次数:188
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->3->3->4->4->5, return 1->2->5. Given 1->1-...
分类:其他好文   时间:2014-07-16 17:30:52    阅读次数:230
java字符串反转
比如我想将 “javascript”反转为 “tpircsavaj”。我们一般处理都是用for循环然后用StringBuffer一个字符一个字符添加。 其实StringBuffer提供了一个reverse方法就可以实现。测试代码如下: package com.evan; public class ReverseTest { public static void main(String[]...
分类:编程语言   时间:2014-07-16 17:19:54    阅读次数:202
[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 ...
分类:其他好文   时间:2014-07-14 19:33:04    阅读次数:215
LeetCode——Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree {3,9,20,#,#,15,7}, ...
分类:其他好文   时间:2014-07-14 17:31:14    阅读次数:229
LeetCode——Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree {3,9,20,#,#,15,7}, 3 / 9 20 ...
分类:其他好文   时间:2014-07-14 17:29:03    阅读次数:166
Scheme 链表转置
原list: ( ( 1 2 ) ( 3 4 ) ) 转置: ( ( 3 4 ) ( 1 2 ) ) 深度转置: ( ( 4 3 ) ( 2 1 ) ) ( define tree ( list 1 ( list 2 ( list 3 4 ) 5 ) ( list 6 7 ) ) ) ( define nil '() ) ( define ( my-reverse items...
分类:其他好文   时间:2014-07-14 13:04:42    阅读次数:170
Binary Tree Preorder Traversal
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]. /** * Definition for bi...
分类:其他好文   时间:2014-07-13 18:46:25    阅读次数:249
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!