https://dev.to/md_mubashir/min-and-max-elements-2d30