Skip to content

Commit

Permalink
Create Problem4.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
ditekunov authored May 26, 2018
1 parent e5bfa69 commit 416a931
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scala/Problem4.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// O(N^2)
object Main extends App {

def palindrome (value: String) = value.substring(0, value.length/2) == value.substring(value.length/2).reverse

print((for (a <- 100 until 999;
b <- 100 until 999 if palindrome(a * b toString))
yield a*b).max)
}

0 comments on commit 416a931

Please sign in to comment.