Problem approach

how to approach to this problem ?

Hi @tusharbhardwaj127
try going through this problem explaination video https://www.youtube.com/watch?v=Uog2Jmyb3iY&feature=youtu.be by Prateek Bhaiya .
If u still feel like something is not clear, u can post ur doubt here

it’s showing time-limit exceeded for 3 test-cases…how to optimize it ?

Hi @tusharbhardwaj127,
there is no need to use two for loops to solve this question.
refer to this code for more help.


if something is unclear in this, u can post ur doubt here.
Hope dis helps.