Python beats 91%, cheap calculation of number of iterations without fancy data structures
IntuitionThe intuition here is that we can easily calculate the number of iterations without traversing the message, by estimating the number of digits of the t
# Intuition
The intuition here is that we can easily calculate the number of iterations without traversing the message, by estimating the number of digits of the total number of chunks. Once we have that value, it is easy to return the result by travesing the message. 

# Approach
Since the size of each chunk depends on the number of digits of the chunk index and the number of digits of total chunks, we first need to find the number of digits of the total chunks.

But that number is limited by the size of input. If len(message)==100,
worst case is less than 100 chuks, which means 3 digits max.

If we assume the number of digits is 1, this means we can split the message in 9 chunks of size (limit-5) where 5 is len("<x/y>")

if 9* (limit-5)>= len(message), we found the number of digits.

If we assume the number of digits is 2, this means we can split the message in 9 chunks of size (limit-6) where 6 is len("<x/yz>") and 90 chunks of size (limit-7) where 7 is len("<xl/yz>") 

if 9* (limit-6)+90*(limit-7)>= len(message), we found the number of digits.

Essentially, we are evaluating the following sum:
$$\sum_{i=0}^{d} 9*10^i*(k-5-i-d)$$
Where d is the total digits, until this is larger than len(message)

Given input maximum size, we only need to try d in range(1,6)


# Complexity
- Time complexity:
I'm not sure about this. Definetely less or equal to $$O(n)$$
- Space complexity:
$$O(n)$$
# Code
```python3 []
class Solution:
    def splitMessage(self, message: str, limit: int) -> List[str]:
        if limit<=3: # escape edge case
            return []
        n = len(message)
        found = False
        for i in range(1,6): # estimating number of digits
            l=0
            for j in range(i):
                actualLimit = limit-4-i-j # how many chars in each chunk
                if l+actualLimit * 9 * (10**j)>=n:
                    found = True
                    # stop searching. Keep values calculated until
                    # last digit to calculate actual number of chunks later
                    break
                if l+s<n and actualLimit ==0:
                    return []
                l+=actualLimit * 9 * (10**j)
            if found:
                break
        # num of chunks is calculated by how many chars
        # we still need to distribute in the last iteration
        # since l+actualLimit * 9 * (10**j) can be larger than n
        rest = ((n-l)//actualLimit)
        if (n-l)%actualLimit!=0:
            rest+=1
        numPages = rest+ 10**(i-1) -1
        result = []
        c= 0
        it = 1
        ptr=0
        actualLimit = limit - 4 - i
        turningPts = set([10,100,1000,10000,100000])
        while c+actualLimit<n:
            if it in turningPts:
                actualLimit-=1
            result.append((message[ptr:ptr+actualLimit])+f"<{it}/{numPages}>")
            ptr+=actualLimit
            c+=actualLimit
            it+=1
        result.append((message[ptr:])+f"<{it}/{numPages}>")
        return result


```
['Python3']