Step 1: Learn the basics›Things to Know in C++/Java/Python or any language
Decision Branching & The Balance Scale
EasyFunction: ifElseif()
ASCI Mission Breakdown • Simple as Hell
"Compare two weights and state whether the first is smaller, greater, or equal to the second."
Real-World Metaphor:
Imagine a physical seesaw at a playground. If child A is lighter than child B, child A goes up ("smaller"). If heavier, child A drops down ("greater"). If they weigh exactly the same, the seesaw rests in balance ("equal").
Interactive Visual WalkthroughFLOW-DIAGRAM
Step 1 / 3
Left (a)5
Right (b)9
Evaluating
1. Place Weights on Scale
Inspect inputs: Left pan a = 5, Right pan b = 9.
How to Think About This (Mental Model)
Check if a < b: if true, immediately return "smaller".
Check if a > b: if true, immediately return "greater".
If neither condition triggered, they must be identical, so return "equal".
### The Mission
You are the official arbiter of a two-pan balance scale. Two contestants place their weights onto the scale: weight **a** on the left pan, and weight **b** on the right pan.
Your job is to compare them and announce one of three verdicts:
- Return **"smaller"** if `a < b` (the left pan is lighter).
- Return **"greater"** if `a > b` (the left pan is heavier).
- Return **"equal"** if `a === b` (both pans balance perfectly).
Examples
Example 1
Input: x = 10, y = 20
Output: 30
Explanation: Returns the processed result of the inputs.
Constraints
-10^5 <= x, y <= 10^5
Topic Tags:
Learn the basicsThings to Know in C++/Java/Python or any languageifElseif