diff --git a/exercises/saddle-points/description.md b/exercises/saddle-points/description.md deleted file mode 100644 index 3c7f26dd42..0000000000 --- a/exercises/saddle-points/description.md +++ /dev/null @@ -1,25 +0,0 @@ -# Description - -Detect saddle points in a matrix. - -So say you have a matrix like so: - -```text - 1 2 3 - |--------- -1 | 9 8 7 -2 | 5 3 2 <--- saddle point at row 2, column 1, with value 5 -3 | 6 6 7 -``` - -It has a saddle point at row 2, column 1. - -It's called a "saddle point" because it is greater than or equal to every element in its row and less than or equal to every element in its column. - -A matrix may have zero or more saddle points. - -Your code should be able to provide the (possibly empty) list of all the saddle points for any given matrix. - -The matrix can have a different number of rows and columns (Non square). - -Note that you may find other definitions of matrix saddle points online, but the tests for this exercise follow the above unambiguous definition. diff --git a/exercises/saddle-points/instructions.md b/exercises/saddle-points/instructions.md new file mode 100644 index 0000000000..2942780cd3 --- /dev/null +++ b/exercises/saddle-points/instructions.md @@ -0,0 +1,24 @@ +# Instructions + +Your task is to find the potential trees where you could build your tree house. + +The data company provides the data as grids that show the heights of the trees. +The rows of the grid represent the north-south direction, and the columns represent the east-west direction. + +An acceptable tree will be the the largest in its row, while being the smallest in its column. + +A grid might not have any good trees at all. +Or it might have one, or even several. + +Here is a grid that has exactly one candidate tree. + + 1 2 3 4 + |----------- +1 | 9 8 7 8 +2 | 5 3 2 4 <--- potential tree house at row 2, column 1, for tree with height 5 +3 | 6 6 7 1 + +- Row 2 has values 5, 3, and 1. The largest value is 5. +- Column 1 has values 9, 5, and 6. The smallest value is 5. + +So the point at `[2, 1]` (row: 2, column: 1) is a great spot for a tree house. diff --git a/exercises/saddle-points/introduction.md b/exercises/saddle-points/introduction.md new file mode 100644 index 0000000000..b582efbd21 --- /dev/null +++ b/exercises/saddle-points/introduction.md @@ -0,0 +1,9 @@ +# Introduction + +You are planning on building a tree house in the woods near your house so that you can watch the sun rise and set. + +You've obtained data from a local survey company that shows the heights of all the trees in each rectangular section of the map. +You need to analyze each grid on the map to find the perfect tree for your tree house. + +The best tree will be the tallest tree compared to all the other trees to the east and west, so that you have the best possible view of the sunrises and sunsets. +You don't like climbing too much, so the perfect tree will also be the shortest among all the trees to the north and to the south.