Explanation

472.Find the Largest of Two Numbers

Easy
Given two integers a and b, return whichever one is larger. If they're equal, either value is correct. This is the simplest possible comparison problem — exactly one condition decides between exactly two outcomes. The if-elseIf-ElseA two-way branch: one block runs if the condition is true, the other if it's false. version spells the comparison out; the ternaryTernary OperatorThe condition ? valueIfTrue : valueIfFalse expression — a compact, single-line if-else. version compacts it into one line once that pattern feels natural.

Example 1:

Input: a = 7, b = 3

Output: 7

Example 2:

Input: a = 2, b = 9

Output: 9

Example 3:

Input: a = 5, b = 5

Output: 5

+ 4 hidden test cases run on Submit.

Constraints:

  • ●-1000 ≤ a ≤ 1000
  • ●-1000 ≤ b ≤ 1000

a =

7

b =

3