[Python] Easy to understand O(N) solution with clear explanations
IntuitionThis is a hard problem at first glance.
You need to know total number of parts (which we call N) the message will be broken into to start breaking down
# Intuition
This is a hard problem at first glance.
You need to know total number of parts (which we call N) the message will be broken into to start breaking down the message, but you won't have that number until you have actually split the message. So what can be done?

# Approach
The key idea here is that you'll only need to know how many digits N is. From the problem description, N can only have between 1 to 4 digits.
In the longest case, if limit is a small number and message is super long (less than 10^4 characters), you'll get fewer than 10,000 parts, which makes N into 4 digits. In the short case, limit will be long and message will be smaller than the limit, meaning you'll get a single digit N.

Since we only need to know how many digits N must have to start, we can test for all possible cases and pick the smallest N that matches our initial guess for count of digits of N.

# Complexity
- Time complexity:
$$O(n)$$ because you will have at most 4x loops over the message length.

- Space complexity:
Also $$O(n)$$ because you will be storing the results in a new list. If output is excluded from space constraints, space complexity reduces to O(1).

# Code
```python3 []
class Solution:
    def splitMessage(self, message: str, limit: int) -> List[str]:
        # i think key is that the optimal solution is brute force
        # but even if you brute force, you will still be O(N)
        # bc the part lengths is unknown but it can atmost be 4 digits in worse case
        # so you'll loop 4 times at most

        # We will call total number of parts N
        # N is unknown in the beginning and we will try to find it by trying different lengths of N (how many digits in N)
        # at the beginning, we will reserve placeholder characters for N
        # at the end when N is known, we will try to replace the placeholder, 
        # but if the len of characters doesn't match, then we will try increasing len of N by 1 and doing the same thing
        
        message_len = len(message)
        for len_n in range(1, 5): # N will have between 1-4 digits
            parts = []
            i = 0
            n_placeholder = '?' * len_n
            while i < message_len:
                item_idx = str(len(parts) + 1)  
                suffix = '<'+item_idx+'/'+n_placeholder+'>'

                # what happens if suffix > limit?
                if len(suffix) >= limit:
                    return []

                # for now let's assume suffix < limit
                msg_part = message[i: min(i+ limit-len(suffix), len(message))]
                parts.append(msg_part + suffix)
                i += limit-len(suffix)

            if len(str(len(parts))) == len_n:
                # it means we have found the answer!
                N = str(len(parts))
                for i, part in enumerate(parts):
                    parts[i] = part.replace(n_placeholder, N)
                return parts

        return []
```
['Python3']