Tap here to switch tabs
Problem
Ask
Submissions

Problem: Confusing Number

easy
15 min
Explore the concept of confusing numbers, which produce valid but different numbers when rotated 180 degrees. Understand the digit rotation rules, evaluate examples, and implement solutions to identify confusing numbers. This lesson helps you develop problem-solving skills for math and geometry challenges often seen in coding interviews.

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

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Confusing Number

easy
15 min
Explore the concept of confusing numbers, which produce valid but different numbers when rotated 180 degrees. Understand the digit rotation rules, evaluate examples, and implement solutions to identify confusing numbers. This lesson helps you develop problem-solving skills for math and geometry challenges often seen in coding interviews.

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