Back/Frequency Map: Common Divisor

Frequency Map: Common Divisor

EasyLevel: 5Topic: Hashing
XP Reward:+50 XPCoin Reward:+5 Coins

You are given two positive integers. Find their greatest common divisor, the largest integer that divides both numbers.

This problem is part of Hashing practice and is designed to strengthen the Frequency Map pattern.

Input Format

  • The input contains two positive integers a and b.

Output Format

Return one integer: gcd(a, b).

Example 1

Input:

54 81

Output:

27

Explanation:

  • For 54 and 81, the largest shared divisor is 27.
  • Therefore, gcd(54, 81) = 27.

Constraints

  • 1 <= a, b <= 10^9

Return Requirement

Implement the starter function for this Easy problem. Read from the raw input string and return only the required answer, with no labels or debug text.

Judge Behavior

Run Code checks the visible sample cases. Submit checks those samples plus additional hidden cases that follow the same input format and constraints.

Loading editor...
Input
54 81
Expected Output
27