Kry Interview Question

Basically explaining the code I did