Implement and analyze number-pattern function | Credit Genie Interview Question