@umesh kewat : In worst case it will be O(nk) in case of your solution.
check for this case: 01-06-11-16 02-07-12-17 03-08-13-18 04-09-14-19 05-10-15-20 -- Krunal -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.