Greedy Algorithms - Partition Labels
Consider this buggy code snippet for Partition Labels. Which line contains the subtle bug that can cause incorrect partitions?
```python
def partitionLabels(s):
last = {c: i for i, c in enumerate(s)}
res = []
start = 0
end = 0
for i, c in enumerate(s):
end = last[c] # Line X
if i == end:
res.append(end - start + 1)
start = i + 1
return res
```
