Skip to content

Instantly share code, notes, and snippets.

@jackliusr
Last active August 29, 2015 14:04
Show Gist options
  • Save jackliusr/d8ccc167c02ace2e3dd4 to your computer and use it in GitHub Desktop.
Save jackliusr/d8ccc167c02ace2e3dd4 to your computer and use it in GitHub Desktop.
Hackerrank Find Digits in Scala
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