Interview Question

Правка en3, от bablu_45, 2019-06-11 21:40:36

Given a 1-d array candy crush, return the shortest array after removing all the continuous same numbers (the no of occurences of repeating number >= 3)

input: 1-d array [1, 3, 3, 3, 2, 2, 2, 3, 1]

return: [1, 1] (Explanation:- 133322231->133331->11).

133322231->122231->131 gives answer as [131] which is not the shortest.

Time complexity should be better than O(n^2)

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский bablu_45 2019-06-11 21:40:36 77
en2 Английский bablu_45 2019-06-11 21:30:32 22
en1 Английский bablu_45 2019-06-11 21:29:59 301 Initial revision (published)