Javascript solution
Example:Step 1: Finding kksasbscAvailable Space (limit * k - (sumOfDigits + totalLenOfIndicies + totalLenOfFormat))Can Fit?11139 * 1 - (1 + 1 + 3) = 4❌22269 * 2
# Example:
### **Step 1: Finding `k`**
| `k` | `sa` | `sb` | `sc` | Available Space (`limit * k - (sumOfDigits + totalLenOfIndicies + totalLenOfFormat)`) | Can Fit? |
|----|----|----|----|--------------------------------|---------|
| 1 | 1 | 1 | 3 | `9 * 1 - (1 + 1 + 3) = 4` | ❌ |
| 2 | 2 | 2 | 6 | `9 * 2 - (2 + 4 + 6) = 5` | ❌ |
| 3 | 3 | 3 | 9 | `9 * 3 - (3 + 9 + 9) = 6` | ❌ |
| ... | ... | ... | ... | ... | ... |
| 14 | 15 | 28 | 42 | `9 * 14 - (15 + 28 + 42) = 37` | ✅ **Found!** |

✅ **Final `k = 14`**


# Complexity
### **Step 1: Finding the correct `k`**
- The loop runs **at most `O(log N)`** times because:
  - The value of `k` grows gradually, increasing when suffix lengths change (`9 → 10`, `99 → 100`, etc.).
  - The length of `k` increases logarithmically (`log N` digits for `N`).
- Inside the loop, we perform:
  - **String operations** (`String(k).length`) → `O(log k)`, but `k` is small (`≤ N`).
  - **Mathematical operations** → `O(1)`.
  - **Total complexity for this step:** `O(log N)`.

---

### **Step 2: Constructing the parts**
- The second loop **iterates `k` times**, where `k` is the number of parts.
- Each iteration **creates a substring (`message.slice()`)**, which is `O(1)`.
- **Total complexity for this step:** `O(N)`, since the message is fully traversed.

---

### **Overall Time Complexity**
| Step | Complexity |
|------|------------|
| Finding `k` (Number of Parts) | `O(log N)` |
| Splitting Message (`O(N)`) | `O(N)` |
| **Total Complexity** | **`O(N log N)`** |

---

## **Space Complexity**
- **`result` stores `k` substrings**, which is proportional to `O(k)`.
- **`String(k).length` and suffix calculations use `O(1)` extra space.**
- **The input `message` is not modified in-place**, so the new array takes `O(N)`.

### **Overall Space Complexity**
| Memory Usage | Complexity |
|-------------|------------|
| Output list (`k` substrings) | `O(N)` |
| Extra variables (`i`, `j`) | `O(1)` |
| **Total Complexity** | **`O(N)`** |

---

## **Complexity Summary**
| Complexity Type | Complexity |
|----------------|------------|
| **Time Complexity** | **`O(N log N)`** |
| **Space Complexity** | **`O(N)`** |


# Code
```javascript []
/**
 * @param {string} message
 * @param {number} limit
 * @return {string[]}
 */
var splitMessage = function (message, limit) {
    let n = message.length;
    let sumOfDigits = 0;  // Sum of digits of each part index

    for (let k = 1; k <= n; k++) {
        sumOfDigits += String(k).length;
        let totalLenOfIndicies = String(k).length * k; // Total length of k indices
        let totalLenOfFormat = 3 * k; // Total length of '<' + '/' + '>'
        
        // Check if the message can fit into `k` parts
        if (limit * k - (sumOfDigits + totalLenOfIndicies + totalLenOfFormat) >= n) {
            let result = [];
            let i = 0;

            for (let j = 1; j <= k; j++) {
                let suffix = `<${j}/${k}>`;
                let maxPartLen = limit - suffix.length;
                let t = message.slice(i, i + maxPartLen) + suffix;
                result.push(t);
                i += maxPartLen;
            }

            return result;
        }
    }

    return [];
};

```
['JavaScript']