5 kyu
Connected blocks (second part)
28surtich
Description:
This is the second part of Connected bloks kata.
We want to generalize the solution in such a way that the grid can have m
dimensions and each dimension with n
values (from 0 to n-1)
Examples:
solution({dimensions: [10, 10], cells: '18,00,95,40,36,26,57,48,54,65,76,87,97,47,00'}) === 3 // two dimensions (x from 0 to 9, and y from 0 to 9)
solution({dimensions: [20, 10], cells: '018,000,095,040,036,026,057,048,054,065,076,087,097,047,000'}) === 3 // two dimensions (x from 0 to 19, and y from 0 to 9)
solution({dimensions: [10, 10, 100], cells: '1800,0000,9500,4000,3600,2600,5700,4800,5400,6500,7600,8700,9700,4700,0000'}) === 3 // three dimensions (x from 0 to 9, y from 0 to 9 and z from 0 to 99)
Notice that the format of a cell is calculated taking into account the number of digits needed for each dimension.
For example, with [20, 10, 1000]
dimension values, the 113012
cell value means:
- x coord: 11
- y coord: 3
- z coord: 012
In addition, two cells are connected if they have the same value in all the existing dimensions except in one and in this one they are different in a unit.
For example, with [20, 10, 1000]
dimension values:
113012
and113013
cells are connected.113012
and113014
are not connected.113012
and123013
are not connected.
Algorithms
Similar Kata:
Stats:
Created | Dec 13, 2017 |
Published | Dec 13, 2017 |
Warriors Trained | 627 |
Total Skips | 278 |
Total Code Submissions | 155 |
Total Times Completed | 28 |
JavaScript Completions | 28 |
Total Stars | 13 |
% of votes with a positive feedback rating | 100% of 13 |
Total "Very Satisfied" Votes | 13 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 4 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 6 kyu |