VARDIGS - Editorial

PROBLEM LINK:

Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4

Author: iceknight1093
Tester: sushil2006
Editorialist: iceknight1093

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

You’re given a two digit number X.
Decide if it has two different digits.

EXPLANATION:

We need to check if the two digits of the given number are different.

Perhaps the simplest way to do this, is to read the value X as a string rather than as an integer.
This allows us to directly compare the two characters forming its digits and see if they’re equal or not.

An alternate solution is to observe that a 2-digit number has equal digits if and only if it’s a multiple of 11.
So, the answer is Yes if X is not a multiple of 11, and No otherwise.

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (PyPy3)
x = int(input())
print('Yes' if x%11 != 0 else 'No')