Problem
Ask
Submissions

Problem: Confusing Number

Easy
15 min
Explore how to determine if a number is confusing by rotating its digits 180 degrees. Learn to apply rotation rules for digits and implement a function to validate such numbers. Understand the problem constraints and practice solving this math and geometry coding challenge.

Statement

A confusing number is a number that, when rotated 180 degrees, produces a valid yet different number.

Digits can be rotated 180180 degrees according to the following rules:

  • The digits 00, 11, 66, 88, and 99 become 00, 11, 99, 88, and 66 respectively when rotated.

  • The digits 22, 33, 44, 55, and 77 become invalid when rotated.

Given an integer n, return true if n is a confusing number, or false otherwise.

Note: Leading zeros in the rotated result should be ignored. For instance, rotating 80008000 yields 00080008, which is simply treated as 88.

Constraints:

  • 00 \leq n 109\leq 10^9

Problem
Ask
Submissions

Problem: Confusing Number

Easy
15 min
Explore how to determine if a number is confusing by rotating its digits 180 degrees. Learn to apply rotation rules for digits and implement a function to validate such numbers. Understand the problem constraints and practice solving this math and geometry coding challenge.

Statement

A confusing number is a number that, when rotated 180 degrees, produces a valid yet different number.

Digits can be rotated 180180 degrees according to the following rules:

  • The digits 00, 11, 66, 88, and 99 become 00, 11, 99, 88, and 66 respectively when rotated.

  • The digits 22, 33, 44, 55, and 77 become invalid when rotated.

Given an integer n, return true if n is a confusing number, or false otherwise.

Note: Leading zeros in the rotated result should be ignored. For instance, rotating 80008000 yields 00080008, which is simply treated as 88.

Constraints:

  • 00 \leq n 109\leq 10^9