Skip to content

Commit 8abb738

Browse files
committed
2729. Check if The Number is Fascinating v2
1 parent e25809b commit 8abb738

File tree

1 file changed

+6
-1
lines changed
  • Check if The Number is Fascinating

1 file changed

+6
-1
lines changed

Check if The Number is Fascinating/kata.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ func countDigits(n int, stats *[9]int) bool {
1818
if digit == 0 {
1919
return false
2020
}
21-
stats[digit-1]++
21+
digit = digit - 1
22+
currentCount := stats[digit]
23+
if currentCount > 0 {
24+
return false
25+
}
26+
stats[digit]++
2227
}
2328
return true
2429
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy