Split Text into Minimum Suffixed SMS Messages
Updated
Problem statement
Split every text character in order into the minimum number y of messages. Message x ends with suffix <x/y>, which counts toward limit.
Every nonlast message must have total length exactly limit; the last may be shorter. Each message contains at least one text character. Return the first feasible split, or an empty array.
Function
splitSms(text: String, limit: int) → String[]Examples
Example 1
text = "abcdefghij"limit = 7return = ["ab<1/5>","cd<2/5>","ef<3/5>","gh<4/5>","ij<5/5>"]Five messages are the first total count with enough capacity.
Example 2
text = "abc"limit = 10return = ["abc<1/1>"]One message fits.
Constraints
1 <= text.length <= 100001 <= limit <= 10000
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Lexicographically Largest IdentifierAmazon · OA
- Lexicographically Smallest Grid Path with One Letter ChangeInfosys · OAInfosys interview questions
- Incident MonitorStripe · OAStripe interview questions
- Balance a Chemical EquationMicrosoft · OAMicrosoft interview questions
- Longest Repeated Letter Block with Adjacent SwapsIntuit · OAIntuit interview questions
- Count Substrings Matching with One Adjacent SwapInMobi · OAInMobi interview questions
- Binary CircuitAkuna Capital · OAAkuna Capital interview questions
- String Formation (Also for AI/ML Software Engineer Intern :)Snowflake · OASnowflake interview questions
- Binary Sorting Rounds After FlipsVisa · OAVisa interview questions
- Minimum Numeric Code TransformationAdobe · OAAdobe interview questions