码迷,mamicode.com
首页 >  
搜索关键字:reverse    ( 5099个结果
【leetcode刷题笔记】Reverse Linked List II
Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No...
分类:其他好文   时间:2014-07-18 00:32:24    阅读次数:271
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
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
大数运算模板
/* 调用方式:add(a, b); 返回类型:string */ string add(string a, string b) { string s; reverse(a.begin(), a.end()); reverse(b.begin(), b.end()); int i = 0; int m, k = 0; while(a[i] && b...
分类:其他好文   时间:2014-07-16 08:04:51    阅读次数:368
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
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 public String reverseWor...
分类:其他好文   时间:2014-07-14 09:06:02    阅读次数:176
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 link...
分类:其他好文   时间:2014-07-13 18:20:52    阅读次数:202
编程算法 - 翻转单词顺序 代码(C)
翻转单词顺序 代码(C)本文地址: http://blog.csdn.net/caroline_wendy题目: 输入一个英文句子, 翻转句子中单词的顺序, 但单词内字符的顺序不变.首先翻转(reverse)整个句子, 然后查找空格, 如遇到空格, 则翻转前面的单词, 或遇到结束符, 同样进行翻转.代码:/* * main.cpp * * Created on: 2014.6.12 * ...
分类:其他好文   时间:2014-07-12 22:56:00    阅读次数:328
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!