List of integers & L.I.S.

n00m n00m at narod.ru
Thu Sep 8 22:05:03 CEST 2005


> 4 5 1 2 3 6 7 8   << the list itself
> 1 2 1 2 3 4 5 6   << ordering numbers for forward direction
> 2 1 6 5 4 3 2 1   << ordering numbers for backward direction
> ===
> 3 3 7 7 7 7 7 7   << sums of the pairs of ord. numbers
Oops! Sorry for miscounting in backward direction.
Should be (anyway the answer stays the same):

4 5 1 2 3 6 7 8   << the list itself
1 2 1 2 3 4 5 6   << ordering numbers for forward direction
5 4 6 5 4 3 2 1   << ordering numbers for backward direction
=== 
6 6 7 7 7 7 7 7   << sums of the pairs of ord. numbers




More information about the Python-list mailing list