Format Bytes into Human-Readable String (B/KB/MB)
Problem: Format Bytes (B/KB/MB)
Given a non-negative integer n representing a number of bytes, format it as a human-readable string using the rules below:
- If
n < 1024, use unitB. - If `1...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
