what's the best way to increment a list of numbers

前端 未结 0 1961
迷失自我
迷失自我 2021-01-21 08:25

I have a list like this x=[1,2,2,3,1,2,1,1,2,2] where the number is a positive integer that increments by 0 or 1 and sometimes resets to 1, and need to transform it to [1,2,2,3,

相关标签:
回答
  • 消灭零回复
提交回复
热议问题