This was the other question I got in my attempt. It is a 2D grid question, and the whole difficulty is in handling the borders and ties correctly. You get a grid of integers with n rows and m columns.