https://www.docodehere.com/2021/06/hackerrank-solution-of-write-function.html