Medium · Streams & I/O
Find files size larger than 5M
Given a directory tree (listed as entries with path, size in bytes and isDir; the first entry is the root directory), return the sorted paths of every file strictly larger than 5 MiB (5 × 1024 × 1024 = 5,242,880 bytes); directories are never counted.
Examples
Example 1
{
"entries": [
{"path": "root", "size": 0, "isDir": true},
{"path": "root/small.txt", "size": 1024, "isDir": false},
{"path": "root/big.bin", "size": 6291456, "isDir": false},
{"path": "root/medium.dat", "size": 3145728, "isDir": false},
{"path": "root/huge.zip", "size": 10485760, "isDir": false}
]
}Output: [root/big.bin, root/huge.zip]
Example 2
{
"entries": [
{"path": "root", "size": 0, "isDir": true},
{"path": "root/a.txt", "size": 100, "isDir": false},
{"path": "root/b.txt", "size": 200, "isDir": false}
]
}Output: []
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.