Grab Interview Question

Three problems in codility. One sql, two standard algorithm problems.