my first version of two of the toptal's exercise in cidility