Anatta Interview Question

Write an algo to Coding pattern