Capital Numbers Interview Question

Simple interview questions but worst process