simple o(n) linear search
Intuition\n Describe your first thoughts on how to solve this problem. \nAt max there can be n partitions.we iterate from 1 to n and check whether it is possibl
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nAt max there can be n partitions.we iterate from 1 to n and check whether it is possible to split in o(1). then once we found ideal partiton size we partition the string in linear search.\n# Approach\nlets say we have m partiton.total *size* = n(size of actual string) + m * 3(each partiton have </>)+ m * lengthof(m) [each partiton should have total partion length] + totalsumof(digit from 1 to m)[we increment at each index making it o(1)];\n\nNOW, we got final size of string now we have to partition to mtimes\nlet psize=(size/m),bias=(size%k>1);\nNow we have make sure every partition have atleast onecharacter and psize+bias<= limit\n\n# Complexity\n- Time complexity:\no(n)\n\n- Space complexity:\no(n)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> inc={10,100,1000,10000};\n    vector<string> splitMessage(string s, int limit) {\n        int n=s.size();\n        //there can be at max n parts;\n        int j=-1;\n        long long prev=0,i0=0,size=1;\n        for(int i=1;i<=n;i++){\n            if(i==inc[i0]){\n                size++;\n                i0++;\n            }\n             long long br=i*3+size*i;//</size> used in each part\n            prev+=size; //add new i length\n            br+=prev+n; //additional lenght;\n            int bias=br%i?1:0;\n            br=br/i;\n            int last=3+2*size+1; //at min this should be size of last element\n            if(br+bias>limit || br<last) continue;\n            j=i;\n            break;\n        }\n        if(j==-1) return {}; //we got our required ith path\n        string lb="/"+to_string(j)+">";\n        vector<string> ans;\n        i0=0;\n        for(int i=1;i<=j;i++){\n            string ind="<"+to_string(i)+lb;\n            int bias=ind.size(),l=1;\n            string str="";\n            str+=s[i0];\n            while(i0+1<s.size() && l+1+bias<=limit){\n                str+=s[i0+1];\n                i0++;\n                l++;\n            }\n            i0++;\n            ans.push_back(str+ind);\n        }\n        return ans;\n        \n    }\n};\n```
['C++']