A - 一二三Time Limit:1000MS Memory Limit:65535KB 64bit IO Format:%I64d & %I64uSubmitStatusDescription你弟弟刚刚学会写英语的一(one)、二(two)和三(three)。他在纸上写了好些一二...
分类:
其他好文 时间:
2014-08-16 00:59:19
阅读次数:
203
本题需要使用选择矩阵的程序求解,这个和Leetcode上的一个程序是一样道理的。如果使用额外空间,那么是很容易做到的,这里不使用额外空间,直接使用到位操作,空间效率是O(1),这是个非常漂亮的到位旋转程序。
题意还是很重要,这次看错了一句话,就WA了一次:
The maximum amount of cells which contains two equal numbers after ov...
分类:
其他好文 时间:
2014-08-15 22:35:29
阅读次数:
288
Air Raid
Problem Description
Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersection and wal...
分类:
其他好文 时间:
2014-08-15 21:13:29
阅读次数:
407
过去已无法改变,未来又难以琢磨,我们只能把握当下[问题描述]Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space ...
分类:
其他好文 时间:
2014-08-15 21:02:49
阅读次数:
165
Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n)
space is pretty s...
分类:
其他好文 时间:
2014-08-15 19:39:39
阅读次数:
222
题目:
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space to hold additional elements from B. The number of elements initia...
分类:
其他好文 时间:
2014-08-15 18:00:09
阅读次数:
194
Let's play a game
Time Limit: 2 Seconds Memory Limit: 65536 KB
Elves from the Lothvain forest have created a very interesting game. The rules are very simple:
There are two players.
...
分类:
其他好文 时间:
2014-08-15 17:56:19
阅读次数:
251
set这个容器也是STL库的一员,并且在algorithm内直接有 set_union set_intersection 这样求并集交集的操作map 最方便的地方就是 支持下标访问举例说明 : 1 #include 2 include 3 #include 4 #include 5 #include...
分类:
其他好文 时间:
2014-08-15 17:24:09
阅读次数:
220
题目链接:Pairs完全就是Two Sum问题的变形!Two Sum问题是要求数组中和正好等于K的两个数,这个是求数组中两个数的差正好等于K的两个数。总结其实就是“骑驴找马”的问题:即当前遍历ar[i],那么只要看数组中是否存在ar[i]+K或者ar[i]-K就可以了,还是用HashMap在O(1)...
分类:
其他好文 时间:
2014-08-15 17:17:19
阅读次数:
123
1,创建字符串,有@都是对象。NSString *myString1 = @"My String One”;将一个utf8编码的字符串实例化成对象NSString *myString2 = [NSString stringWithUTF8String:"My String Two"];第三种写法NS...
分类:
其他好文 时间:
2014-08-15 14:25:48
阅读次数:
289