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}, reorder it to ...
分类:
其他好文 时间:
2014-12-29 21:34:09
阅读次数:
242
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.
...
分类:
其他好文 时间:
2014-12-29 12:07:24
阅读次数:
141
今天学习SQL Server数据库中DML触发器(DDL触发器以后有时间继续学习)。当删除一条创建有触发器的表中的内容时,触发器执行SQL语句。1.首相先创建一张表,表名称是 [Test] , 内有三个字段,分别是 [Name], Sex, Place.1 use inter2 create tab...
分类:
数据库 时间:
2014-12-28 22:10:17
阅读次数:
152
题目: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...
分类:
其他好文 时间:
2014-12-28 16:45:12
阅读次数:
182
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...
分类:
其他好文 时间:
2014-12-28 14:16:37
阅读次数:
169
笔试了,时间1个半小时。没想到居然有7/10是开放性问题。大意例如以下:1、为什么选择增加ThoughtWorks。200字以内,不能用“interesting”、“challenge”等词汇amazing place, I found that almost all TWers love this...
分类:
其他好文 时间:
2014-12-27 11:20:20
阅读次数:
255
Flatten Binary Tree to Linked ListGiven a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / ...
分类:
其他好文 时间:
2014-12-26 14:19:14
阅读次数:
310
Basic plan for in-place sort.
a.Create max-heap with all N keys.
b.Repeatedly remove the maximum key.
Procesure
#include
#include
int N=11;
char a[]={' ','S','E','E','L','M','O','P','R','S','T','...
分类:
其他好文 时间:
2014-12-26 09:42:19
阅读次数:
186
Debugging in Code 有两个调试layout问题的阶段。1. Map from “this view is in the wrong place” to “this constraint (or these constraints) is (are) incorrect.” 2. Ma...
分类:
其他好文 时间:
2014-12-25 17:52:51
阅读次数:
186
题目描述:
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
思路:先将行顺序reverse,然后再对每个处于下三角区域的元素rotate。
...
分类:
其他好文 时间:
2014-12-25 11:18:52
阅读次数:
125