【题目】
原文:
2.1 Write code to remove duplicates from an unsorted linked list.
FOLLOW UP
How would you solve this problem if a temporary buffer is not allowed?
译文:
从一个未排序的链表中移除重复的项
...
分类:
其他好文 时间:
2014-05-22 12:04:13
阅读次数:
196
Gallery和swithcer联合使用
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in complian...
分类:
其他好文 时间:
2014-05-22 11:19:05
阅读次数:
288
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these children subjected to the following requirements:
Each child must have at least one candy.
Children with a higher rating get more candies than...
分类:
其他好文 时间:
2014-05-22 11:00:49
阅读次数:
285
【题目】
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no du...
分类:
其他好文 时间:
2014-05-22 10:43:12
阅读次数:
310
【题目】
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Here are few examples.
[1,3,5,6], 5 → 2
[1,3,5,6]...
分类:
其他好文 时间:
2014-05-22 09:41:59
阅读次数:
195
<!--
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the L...
分类:
移动开发 时间:
2014-05-22 08:41:44
阅读次数:
377
题目:
链接:点击打开链接
题意:
有n个朋友,编号为1......n。知道其中一些人相互认识,求最少需要多少桌子。
算法:
并查集算法的模板题。
(来源:LCY-teacher课件)
>>在某个城市里住着n个人,现在给定关于 n个人的m条信息(即某2个人认识)假设所有认识的人一定属于同一个单位,请计算该城市最多有多少单位?
>>如何实现...
分类:
其他好文 时间:
2014-05-22 08:03:40
阅读次数:
314
上联:no zuo no die why you try
下联:no try no high give me five
横批: let it go。
坑爹bug:
错误写法:
0 } ">true (最后一个大括号后多出一个空格,代码啥都不会输出)
正确写法: 0 }">true 正确写法 输出结果: true...
分类:
Web程序 时间:
2014-05-22 07:42:52
阅读次数:
355
问题
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}, reorde...
分类:
其他好文 时间:
2014-05-22 07:04:46
阅读次数:
298
只有熟练的使用才能熟练的掌握Vi。
在网页中快速查询,输入ctrl+F。具体实践中,不清楚的地方请自己尝试。
1 Vi的两个模式
Vi 分为命令模式和插入模式。命令模式用于输入命令,来进行移动光标等操作;插入模式就是用来输入文本的。
刚进入vi是命令模式,按i键可以进入插入模式,按Esc键可以进入命令模式。
2.打开和关闭文件
命令行输入vi filename,如果存在...
分类:
其他好文 时间:
2014-05-20 16:00:35
阅读次数:
209