The output is coming TLE

i thought of calling recursion of the left and right parts and storing the 0/1 in an vector but as expected it is coming as an TLE. i tried to use memoization but couldn’t. Is there any other way

@akshatsaraswat03
Your approach is in the wrong direction
You are precalculating the result
Please see this once https://ide.codingblocks.com/s/224747
You can calculate the result on the go
If your doubt is resolved please close it

i still don’t understand the approach