[Python] step-by-step explanation
python\nclass Solution:\n    def getMaximumConsecutive(self, coins: List[int]) -> int:\n        # 1) if we can use first k coins to make values 0...v,\n        
```python\nclass Solution:\n    def getMaximumConsecutive(self, coins: List[int]) -> int:\n        # 1) if we can use first k coins to make values 0...v,\n        #    it means the combination of first k coins can cover values 0...v\n        # 2) what\'s the condition for k + 1 coin s.t. we can make v + 1\n        #    if it\'s 1     ==> (v)     + 1     = v + 1\n        #    if it\'s 2     ==> (v - 1) + 2     = v + 1\n        #    if it\'s v     ==> (1)     + v     = v + 1\n        #    if it\'s v + 1 ==> (0)     + v + 1 = v + 1\n        #    if it\'s v + 2 ==> No solution\n        # 3) actually:\n        #    if it\'s 1     ==> (0...v) + 1     = 0...(v + 1)\n        #    if it\'s v + 1 ==> (0...v) + v + 1 = 0...(v + v + 1)\n        # 4) now we can conclude that\n        #    if i-th coin <= v + 1 ==> we can make v + 1 + i-th coin\n        \n        coins.sort()\n        v = 0  # we can make 0...v\n        for i in range(len(coins)):\n            if coins[i] <= v + 1:\n                v += coins[i]\n            else:\n                break\n        return v + 1  # [0...v]: v + 1 values\n        \n        # T: O(sort) + O(n)\n        # S: O(sort)\n```
[]