dp[0][i]=min. cost till 'i' if a[1] was not taken,
dp[1][i]=min. cost till 'i' if a[1] was taken.
Read more… (19 words)
dp[0][i]=min. cost till 'i' if a[1] was not taken,
dp[1][i]=min. cost till 'i' if a[1] was taken.
Why would a O(N) = N*log N solution give TLE when N=10^6....???
O(N=10^6) = (6*10^6) < (2*10^8)