Easy · Streams & I/O
Reverse content of file in place
Given the path of a file, reverse the order of its bytes and write the result back to that same file (a file holding "hello" ends up holding "olleh"); an empty file stays empty.
Examples
Example 1
{
"content": "hello"
}Output: "olleh"
Example 2
{
"content": "abcd"
}Output: "dcba"
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.