6 kyu
Product of Adjacent Grid Numbers
81 of 120ThomasL
Description:
A grid of numbers with an equal height and width is given and your task is to find the largest possible product between four adjacent numbers in the same direction. The directions can be horizontal, vertical or diagonal.
Some example grids are shown below.
04 04 04 04 01 01 | 04*04*04*04 = 256
01 01 01 01 01 01 |
01 01 01 01 01 01 |
01 01 01 01 01 01 |
01 01 01 01 01 01 |
01 01 01 01 01 01 |
01 01 01 01 01 04 | 04*04*04*04 = 256
01 01 01 01 01 04 |
01 01 01 01 01 04 |
01 01 01 01 01 04 |
01 01 01 01 01 01 |
01 01 01 01 01 01 |
04 01 01 01 01 01 | 04*04*04*04 = 256
01 04 01 01 01 01 |
01 01 04 01 01 01 |
01 01 01 04 01 01 |
01 01 01 01 01 01 |
01 01 01 01 01 01 |
01 01 01 04 01 01 | 04*04*04*04 = 256
01 01 04 01 01 01 |
01 04 01 01 01 01 |
04 01 01 01 01 01 |
01 01 01 01 01 01 |
01 01 01 01 01 01 |
The smallest grid that can be given is 4x4 and the contained numbers will have a minimum value of 1 and a maximum value of 99.
A solution should be created to test all combinations of vertical, horizontal and diagonal lines.
Adapted from Project Euler.
Algorithms
Similar Kata:
Stats:
Created | Oct 18, 2016 |
Published | Oct 18, 2016 |
Warriors Trained | 451 |
Total Skips | 63 |
Total Code Submissions | 1608 |
Total Times Completed | 120 |
JavaScript Completions | 81 |
PHP Completions | 43 |
Total Stars | 17 |
% of votes with a positive feedback rating | 90% of 41 |
Total "Very Satisfied" Votes | 35 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |