Multiplier interview question

Coding skills - They gave me DP problem