How to solve N queries on array on N elements in linear time O(N).

Правка en1, от shubhamcr7, 2016-10-15 08:16:12

Given an array of n elements. ‘n’ operations needs to be performed on the array. For each operation start_index, end_index,trim_value is given. One has trim the value starting from the start_index to end_index inclusive. If the value at that index is more than or equal to trim value then make it equal to trim_value else leave it as it is. After performing ‘n’ operations find the maximum value of the array.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский shubhamcr7 2016-10-15 08:16:12 475 I have been trying to solve in O(n) time for quite a long time but haven't got the logic yet? Can anyone please help me out figuring out linear time complexity solution for this problem. (published)