2468. Split Message Based on Limit
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def splitMessage(self, s: str, limit: int) -> List[str]:
        cursor = part_count = pointer = 0
        while 3 + len(str(part_count)) * 2 < limit and cursor + len(s) + (3 + len(str(part_count))) * part_count > limit * part_count:
            part_count += 1
            cursor += len(str(part_count))
        segments = []
        if 3 + len(str(part_count)) * 2 < limit:
            for i in range(1, part_count + 1):
                remaining_space = limit - (len(str(i)) + 3 + len(str(part_count)))
                segments.append(f'{s[pointer:pointer + remaining_space]}<{i}/{part_count}>')
                pointer += remaining_space
        return segments

```
['Python3']