h*********d 发帖数: 1054 | 1 given a string - tuTutuuti, print it as output: t3u4T1i1 in O(n) time
without using any extra spaces and maps/etc other data structures
O(n) time and O(1) time? use counting sort? |
q****m 发帖数: 177 | 2 constant space 是O(1)space
【在 h*********d 的大作中提到】 : given a string - tuTutuuti, print it as output: t3u4T1i1 in O(n) time : without using any extra spaces and maps/etc other data structures : O(n) time and O(1) time? use counting sort?
|
d******k 发帖数: 32 | 3 怀疑究竟有没有这样的答案。
【在 h*********d 的大作中提到】 : given a string - tuTutuuti, print it as output: t3u4T1i1 in O(n) time : without using any extra spaces and maps/etc other data structures : O(n) time and O(1) time? use counting sort?
|
p*****p 发帖数: 379 | 4 without using any extra spaces应该是不可能的,不然abc -> a1b1c1怎么办
O(1)可行,假设共n个不同字符,把缓冲区扩到2n然后从后往前走
【在 h*********d 的大作中提到】 : given a string - tuTutuuti, print it as output: t3u4T1i1 in O(n) time : without using any extra spaces and maps/etc other data structures : O(n) time and O(1) time? use counting sort?
|