@suhasesturi I don think so. In this line we are checking if the previous value in my dp was true.
i is the current value of the dp which will be false initially.