Tap here to switch tabs
Problem
Submissions

Problem: Confusing Number

Confusing Number asks you to rotate every digit of an integer by 180 degrees and return whether the result is valid and different from the original, ignoring leading zeros.

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:

  • 0≤0 \leq n ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Confusing Number

Confusing Number asks you to rotate every digit of an integer by 180 degrees and return whether the result is valid and different from the original, ignoring leading zeros.

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:

  • 0≤0 \leq n ≤109\leq 10^9