Tip:
Highlight text to annotate it
X
So here's how I chose to do it.
I first picked out the first pair,
and if there are 2 pairs, that should be the highest,
because remember, the ranks are ordered from highest to lowest,
so if I'm going through the ranks from left to right,
I should hit the highest one first.
And then to find if there's a low pair,
what I've done is reverse the ranks
and then look through those, so now I'm going from
lowest to highest, and I should find the lowest pair first.
Now if I found a pair, and I found a low pair,
which is not equal to the pair, then I want to return the two of them.
Otherwise I just return none.
So congratulations.
We've gone through the whole program.
We've come up with a solution,
and now when we hit the Run button,
it prints out "tests pass," so we've done everything
that we promised to do, and it works okay.
But I'm still not confident because
I know we've done some tests, but we haven't done exhaustive tests yet,
so I feel pretty good about it.
You should feel good about what we've done together.
Congratulations on that.
But don't feel like we're done yet.
We've still got to come up with more tests
to prove that we've got it right in every case,
and in fact, I want to share with you a test that somebody pointed out to me
that I hadn't thought of at all.