码迷,mamicode.com
首页 >  
搜索关键字:reverse    ( 5099个结果
7.Reverse Integer (INT; Overflow)
Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321思路:要注意溢出。用以下做法,会溢出。class Solution {public: int reverse(in...
分类:其他好文   时间:2015-07-15 16:40:17    阅读次数:83
JavaScript Array、Date、String
Array:数组push:往数组末尾添加值,可以是一个或者多个。 alert(arr.push(4, 5))join:连接数组元素,中间有分隔符。 var str = arr.join(" "); alert(str);reverse:点到数组的顺序,是操作本身。 alert(arr.rev...
分类:编程语言   时间:2015-07-15 01:17:32    阅读次数:261
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 ...
分类:其他好文   时间:2015-07-14 22:40:56    阅读次数:165
Leetcode 190 Reverse Bits
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:其他好文   时间:2015-07-14 17:21:41    阅读次数:109
[Leetcode]Reverse Linked List II
//将list存入vector,然后翻转中间部分数列 class Solution { public:     ListNode* reverseBetween(ListNode* head, int m, int n) {         vector node;         ListNode* cur = head;         for(int i=0;i        ...
分类:其他好文   时间:2015-07-14 10:12:31    阅读次数:109
[LeetCode] Reverse Bits
Question:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100)...
分类:其他好文   时间:2015-07-13 20:25:01    阅读次数:93
[LeetCode] Reverse Linked List
Reverse a singly linked list.思路:新建一个ListNode,最后返回这个ListNode.next。中间使用两个临时指针一个指向原来的链表头,一个指向新的链表的next.每次循环都往里面插入新的tempNode.时间复杂度:O(n)代码: public ListN...
分类:其他好文   时间:2015-07-13 15:29:45    阅读次数:138
2015华为机试——计算整数的位数
题目描述: 输入一个五位以内(包括5位)的正整数,(1)判断它是一个几位数;(2)逆序输出其各位数字。 输入:多组数据,每组一行 输出:对应一行输出 样例输入:56439 样例输出:5 93465 解题思路:使用StringBuffer的reverse方法即可。...
分类:其他好文   时间:2015-07-13 12:24:51    阅读次数:127
[java]反转单项链表,用O(n)时间和O(1)空间
链表数据结构public class ListNode { public int val; public ListNode next; public ListNode(int x) { val = x; }}反转代码public ListNode reverse...
分类:编程语言   时间:2015-07-13 11:59:35    阅读次数:129
字符串操作
字符串反转 #include "stdafx.h" #include using namespace std; char*reverse_str(char*str); int _tmain(int argc, _TCHAR* argv[]) { char*str = "abcdefgh"; char*dst = reverse_str(str); cout << dst << ...
分类:其他好文   时间:2015-07-12 12:45:18    阅读次数:124
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!