Can anyone explain the possible logic and implementation for this problem ?
Actually ,I was solving a problem on codechef but most often I confuse how to design and the algorithm ,like where to use which type of sorting and searching algo , there fore I request you to please guide me in the reference of this problem on codechef . https://www.codechef.com/ZCOPRAC/problems/ZCO12002 Create : array for input start ,end ,uses of V wormholes and uses of W wormholes . Now as per I think , I would perform a linear search on start time contest by comparing it to each inputs of uses of V wormhole and would return the just greater than it and then compare that index with the elements in end time of contest and if the value if feasible for the inputs of uses of W wormholes , then add the time difference as per question t2-t1+1 in a separate array and finally print the least of them as answer . But this will be lot time consuming too What is the best way to think for such problem and implement the logics . Any suggestions is highly appreciated! Thanks! My language is Java