LC: 1088. Confusing Number II - spiralgo/algorithms GitHub Wiki

1088. Confusing Number II:

The Essence:

  • if it does not equal itself when it is rotated 180 degrees, it is a confusing number.

  • If it equals itself when it is rotated 180 degrees, it is a strobogrammatic number.

Details:

Therefore:

(Total numbers) - (strobogrammatic numbers) = (confusing numbers)

It means, we can use the code here https://github.com/spiralgo/algorithms/pull/323, and just subtract its output from the total count of all numbers generated using 0, 1, 6, 8, 9.

For the implementation: https://github.com/spiralgo/algorithms/pull/324