Ripple interview question

LeetCode Easy. Straight forward coding Q's