Prepare Notification
Problem Overview
- Task: Create a mobile notification from a message limited to K characters; if too long, remove whole words from the end.
- If cropped, append a space and "..." and keep length no more than K; if nothing fits, return "...".
- Inputs/outputs: String message and int K; output the final notification string.
- Constraints: K [3..500], message length [1..500], letters and single spaces, no leading/trailing spaces.
- Microsoft interviews coding interview problem in a mobile UX context; a common interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
