Last active
August 29, 2015 14:04
-
-
Save jackliusr/d8ccc167c02ace2e3dd4 to your computer and use it in GitHub Desktop.
Hackerrank Find Digits in Scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Solution { | |
def main(args: Array[String]) { | |
val lines = io.Source.stdin.getLines().drop(1).toList | |
lines.foreach( l =>{ | |
val num = l.toInt | |
println(l.map(c => c.asDigit).count( d => d != 0 && num % d == 0)) | |
} ) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment