Easy · Math

Is strobogrammatic number

Given a string s of digits, return true if s reads the same after a 180° rotation (0, 1 and 8 rotate to themselves, 6 and 9 rotate into each other, and 2, 3, 4, 5, 7 cannot be rotated), otherwise false.

Examples

Example 1

{
  "s": "69"
}

Output: true

Example 2

{
  "s": "962"
}

Output: false

Rebuild it in the studio

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Math problems