cybersecurity · beginner · ~15 min · safe pentest lab
Check a size against a limit.
Check whether an evidence bundle fits within a storage or transfer limit.
Implement int fits_archive(long total, long max) that returns 1 if total <= max, and 0 otherwise.
total: the bundle's total size.max: the allowed limit.Returns 1 if the bundle fits (total <= max), 0 otherwise.
fits_archive(900, 1000) -> 1
fits_archive(1100, 1000) -> 0
total exactly equal to max fits (return 1).The bundle size total and the limit max (long).
1 if total <= max; otherwise 0.
total == max counts as fitting.
int fits_archive(long total, long max) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.