Python 5.11 Compute the Next Permutation

#1

In this exercise I believe there was a mixup in one of the examples. It states:

“These 12 arrays appear in increasing lexivographical order. Given two integer arrays of equal length, say (a0, a1, …, ak-1) and (b0, b1, …bk-1) the first one is smaller than the second one for the lexicographical order, if ai<bi, for the first i where ai and bi differ. For example, (2, 0, 1) < (2, 1, 0), and (2, 2, 4, 1, 3) < (2, 2, 1, 4, 3).”

This last example I believe is incorrect and should be switched around. (2, 2, 1, 4, 3) < (2, 2, 4, 1, 3).

0 Likes