Texas Instruments interview question

pseudeocode for the given coding challenges.