MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / IsGood

Function IsGood

LeetCode_problems/Rotate Digits/solution.js:1–13  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

1var IsGood = function (n) {
2 let result = false;
3 while (n > 0) {
4 // Checking the last digit of the number by mod 10
5 let digit = n % 10;
6 // ignore 0, 1, 8; by themselves, no change
7 if (digit === 3 || digit === 4 || digit === 7) return false;
8 if (digit === 2 || digit === 5 || digit === 6 || digit === 9) result = true;
9 // excluding the last digit
10 n /= 10;
11 }
12 return result;
13};
14
15var rotatedDigits = function (N) {
16 let count = 0;

Callers 1

rotatedDigitsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected