Question in O(N)

Revision en5, by rahul_1234, 2016-07-07 16:03:35

Hi, I wanted to solve this question in O(N) but couldn't think of it. I did it in O(N logN ) using priority queue but can somebody provide me O(N) solution.

https://postimg.org/image/c31iexg13/ The link of question is not opening now, so I have shared the pic of question.

Tags o(n)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en9 English rahul_1234 2016-07-07 16:32:25 0 (published)
en8 English rahul_1234 2016-07-07 16:28:06 0 (saved to drafts)
en7 English rahul_1234 2016-07-07 16:27:30 11
en6 English rahul_1234 2016-07-07 16:03:50 2 Tiny change: '1iexg13/\nThe link' -> '1iexg13/\n\nThe link'
en5 English rahul_1234 2016-07-07 16:03:35 58
en4 English rahul_1234 2016-07-07 16:00:51 84
en3 English rahul_1234 2016-07-07 15:58:58 67
en2 English rahul_1234 2016-07-07 15:47:20 2 Tiny change: 'olution.\nhttps://' -> 'olution.\n\nhttps://'
en1 English rahul_1234 2016-07-07 15:46:57 227 Initial revision (published)