s*******e 发帖数: 664 | 1 ☆─────────────────────────────────────☆
Dan916 (Dan) 于 (Thu Aug 13 12:27:53 2009, 美东) 提到:
(1)Implement 3 Stacks in one array.
怎样能充分利用空间, 即 cannot declare stack overflow unless the array is
completely full.
而且又avoid shifting.
网上查了查好像没什么方法能同时满足两个条件的??
(2)Given a 2-Dimensional(MXN) array if A[i][j]=1 Set all ith row and jth
column elements as '1'. linear running time, and constant space requirement.
这题应该是reuse第一行和第一列来记录哪行要变1了. 但如果是第一行或第一列里的任
何一个是1, last scan will just mess up the 1s recorded i |
|