how the time complexity is O(n + m) ? It should be O(n*m).
Time complexity
@Rishi-Raj-498676387415689 yes originally n*m is calculating for every n but using dp most of the answers were precalculated so dont have to calc for all n thats why o(n+m)
hope its clear if yes dont forget to hit like and mark resolved 