question link: https://hack.codingblocks.com/contests/c/547/907
i am not able to guess how to solve this question,any hint will be appreciated.
unoptimised solution:https://ide.codingblocks.com/s/43462
question link: https://hack.codingblocks.com/contests/c/547/907
i am not able to guess how to solve this question,any hint will be appreciated.
unoptimised solution:https://ide.codingblocks.com/s/43462
This problem is somewhat similar to binary_search or divide and conquer, or you may think this in terms of query part of segment trees. Basically, you have to use divide and conquer. Think of some recursion to solve it.
Let me help you understand the sample case.
9 6 9
https://ide.codingblocks.com/s/43530
This is my solution. Avoid looking at it because this will spoil the fun of this amazing problem.
Keep coding…!!