Explanation

Code