Skip to content

Given an N × N grid of integers and an integer M ≤ N , determine the maximum product that can be made from M integers that are next to each other in the grid (horizontally, vertically, or diagonally.)

Notifications You must be signed in to change notification settings

YashChat/Max-Product-Grid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Max-Product-Grid

Given an N × N grid of integers and an integer M ≤ N , determine the maximum product that can be made from M integers that are next to each other in the grid (horizontally, vertically, or diagonally.)

Consider the grid below.

0 1 2 3 4 0 4 5 8 1 9 1 7 8 9 7 0 2 0 1 2 8 4 3 7 2 9 1 5 4 3 9 3 5 8

The grid is of size 5 × 5 . If we consider any set of 3 integers in the grid (horizontally, vertically, or diagonally), we find that the set with the highest product is {9, 9, 8} with a product of 9 × 9 × 8 = 648.

In this part of the project, you must implement a solution to the following problem.

Given an N × N grid of integers and an integer M ≤ N , determine the maximum product that can be made from M integers that are next to each other in the grid (horizontally, vertically, or diagonally.) Some of the test grids will be quite large, so we need to think about the performance of the algorithm.

About

Given an N × N grid of integers and an integer M ≤ N , determine the maximum product that can be made from M integers that are next to each other in the grid (horizontally, vertically, or diagonally.)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages