- 博客(3)
- 收藏
- 关注
原创 稳定排序问题,要求O(n)时间,O(1)空间
问题: 微软: 给定一个 Integer Array,只有正数和负数。使让所有正数排在所有负数后面,所有正数间相对位置不变,所有负数间相对位置不变。要求 In-Place,空间复杂度 O(1)。 Facebook:一个记录数组,每个记录的关键字是0,1,2三个数中的一种,要求将数组按关键字排序。要求算法是稳定排序,O(n)时间,常数空间。 Amazon:一个数组,包含positive
2012-03-21 13:28:35 1553
原创 Longest Subarray with Equal "1" and "0"
Problem: Given an array that only contains "1" and "0", find the longest subarray which contains equal number of "1" and "0". Solution: With hash table, we can have a O(N) solution. The detail is a
2012-03-21 10:37:20 731
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人