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
Core interview problems are free with a full runner and lessons; Pro opens the complete library.