
Matrix "Hatching"
You are given a 2-dimensional matrix: a list of lists of integers. Your function should return another Iterable of lists, where each inner list is a sequence of matrix elements on the same diagonal "stroke". The order of elements in the "stroke" is SW -> NE. So, building these sequences is like "hatching" the matrix!
Let's look at the example. The matrix may NOT be square!
->[1] / ->[4, 2] / / ->[7, 5, 3] / / / _->[8, 6] [1, 2, 3]/_->[9] [4, 5, 6]/ [7, 8, 9]
Input: List of lists of integers.
Output: List or another Iterable (generator, iterator) of lists of integers.
Examples:
assert list(hatching([[0]])) == [[0]] assert list(hatching([[1, 2], [3, 4]])) == [[1], [3, 2], [4]] assert list(hatching([[1, 2, 3, 4, 5], [6, 7, 8, 9, 0]])) == [ [1], [6, 2], [7, 3], [8, 4], [9, 5], [0], ] assert list(hatching([[1, 2], [3, 4], [5, 6], [7, 8], [9, 0]])) == [ [1], [3, 2], [5, 4], [7, 6], [9, 8], [0], ]
CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.
In order to install CheckiO client you'll need installed Python (version at least 3.8)
Install CheckiO Client first:
pip3 install checkio_client
Configure your tool
checkio --domain=py config --key=
Sync solutions into your local folder
checkio sync
(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)
checkio serv -d
Alternatevly, you can install Chrome extension or FF addon
checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium
Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.