C# SaddlePoints - possible mismatch between test cases and problem description

Hi,
Thanks for all the work that’s gone into building this resource—it’s been a great help.

I’ve been working through the C# SaddlePoints exercise and ran into a potential inconsistency between the problem description and the test cases. The description defines a “good tree” as:

  • Taller than every tree to the east and west
  • Shorter than every tree to the north and south
  • The largest in its row, while being the smallest in its column

However, some test cases seem to contradict this. For example:

Test: Can_identify_that_saddle_points_in_a_single_column_matrix_are_those_with_the_minimum_value

int[,] matrix = {
    { 2 },
    { 1 },
    { 4 },
    { 1 }
};
HashSet<(int, int)> expected = [(2, 1), (4, 1)];

In this matrix, no element is shorter than every tree to the north and south, so by the problem description, I would expect the result to be [].

I may be misinterpreting something, but I wanted to flag it in case others run into the same confusion. Happy to be corrected if I’ve misunderstood.

Thanks again!

The wording in this exercise has been tricky to nail down and been worksmithed a lot. The instructions should also say,

An acceptable tree will be the largest in its row, while being the smallest in its column.

When in doubt, the tests are the source of truth.

1 Like

Thanks for the quick reply. I can offer new wording to help others who do the exercise:

Candidate trees are those that meet both of these criteria:

  • Are as tall as the tallest tree in their row (east to west)
  • Are as short as the shortest tree in their column (north to south)

(and then the third sentence that you mentioned can be deleted).

I will be leaving my solution as-is, but perhaps this wording change will help those who follow after me.

Again, well done to Exercism and its community on building this fantastic resource!

1 Like

Yeah, I like that. If other maintainers are interested, I’d be in favor of updating the problem-specifications repo docs with something along those lines.

See also Saddle Point exercise: clarify/correct the introduction and Dubious Wording in Saddle Points Exercise

2 Likes

Was going to chime in earlier, but … forced myself not to. :laughing: If you search, there are more. This exercise has had many revisions since 2023.

IIRC, there was specifically a PR that removed the “as tall as the tallest tree” / “as short as the shortest tree” phrasing. But I could be mis-remembering.