Counting order preserving displacements of elements in a list.

The problem is as follows:

Consider an ordered list of positive integers with possible zeros in between. Example:

[0, 1, 0, 0, 2]

The question is, how many possible displacements of these positive numbers do exist such that the list still remains ordered.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store