Hi here’s the link could somebody please explain the dynamic programming approach for this question given in the editorial…here’s the link…

how to get eqn (2)…what does Ai actually represent,if L=F§,what does it signify…i didnt anything much in the whole thing…
could somebody please help…thanks

note on my code: initialize the array of power 2, starting from 0 goes to 11. after getting p, starting from the maximum value of array(here 2048, index is arr[11]=2048) and check if p is equal to or greater than that value. if so, p=p-arr[i], count++. i also increased i++ so that continues from the index last visited. thnx