:type n: int :rtype: int
(self, n)
| 60 | self.a = A |
| 61 | |
| 62 | def next(self, n): |
| 63 | """ |
| 64 | :type n: int |
| 65 | :rtype: int |
| 66 | """ |
| 67 | for i in range(0, len(self.a), 2): |
| 68 | if self.a[i] > 0: |
| 69 | if self.a[i] - n >= 0: |
| 70 | self.a[i] -= n |
| 71 | return self.a[i+1] |
| 72 | else: |
| 73 | t = self.a[i] |
| 74 | self.a[i] -= n |
| 75 | n -= t |
| 76 | return -1 |
| 77 | |
| 78 | |
| 79 | # Your RLEIterator object will be instantiated and called as such: |
nothing calls this directly
no outgoing calls
no test coverage detected