Interview Questions/Coding/Even Load Split Permit

Even Load Split Permit

Preview mode. Log in to edit, run, submit, and save progress.

Easy

Even Load Split Permit

A logistics load of weight w must be split into two positive even weights. Both resulting parts must be greater than zero. For each requested load, decide whether such a split is possible. Input Format: The first line contains t, the number of test cases. Each test case contains w. Output Format: For each test case, print YES if the load can be split as required, otherwise print NO.

Examples

Example 1
Input:
1
8
Output:
YES

Explanation: The load can be split into 2 and 6, both positive even weights.

Approach hint

Start with the simplest clear approach, explain the trade-off, then move toward the cleaner answer.

Common mistake

Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.

solution.cpp