欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Reverse Linked List II
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,
ret...
分类:
其他好文 时间:
2015-02-15 10:49:55
阅读次数:
163
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
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....
分类:
其他好文 时间:
2015-02-15 10:47:12
阅读次数:
155
插入排序(Insertion Sort)是一种简单直观的排序算法。它的工作原理是通过构建有序序列,对于未排序数据,在已排序序列中从后向前扫描,找到相应位置并插入。插入排序在实现上,通常采用in-place排序(即只需用到O(1)的额外空间的排序),因而在从后向前扫描过程中,需要反复把已排序元素逐步向...
分类:
编程语言 时间:
2015-02-14 21:23:05
阅读次数:
280
You are given an n x n 2D matrixrepresenting an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
HideTags
Array
#pragma once
#include
#include
using n...
分类:
其他好文 时间:
2015-02-12 22:52:50
阅读次数:
157
Given a sorted array, remove the duplicates in place such that eachelement appear only once and return the new length.
Do not allocate extra space for another array, you must do this in placewith con...
分类:
其他好文 时间:
2015-02-12 22:52:00
阅读次数:
143
题目 Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.代码p...
分类:
其他好文 时间:
2015-02-12 18:34:55
阅读次数:
144
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Remove Element
Given an array and a value, remove all instances of that value in place and return the new length.
The order of elements can be changed. It doesn't...
分类:
其他好文 时间:
2015-02-12 18:30:54
阅读次数:
159
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new
length.
Do...
分类:
其他好文 时间:
2015-02-12 18:30:37
阅读次数:
113
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2015-02-11 18:19:57
阅读次数:
152
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with...
分类:
其他好文 时间:
2015-02-11 16:45:16
阅读次数:
144