how to do this question without brute force what is the efficient way and check my code also
how to find logic for an efficient way
code:- https://ide.codingblocks.com/s/461689
ques:- https://online.codingblocks.com/app/player/189104/content/180066/5023/code-challenge