Euler problem 4 Scala

Ok here is scala solution for problem 4. I am sure there would be easier, better and more functional ways. So feel free to post any more functional approaches

object Prob4 {
  def main(args: Array[String]) = {
    println("Start euler prob 4")
    val listOne = (999 to 1 by -1)
    val result =
        for {i <- 999 to 1 by -1
         j <- 999 to 1 by -1
         val mult = i * j
        if (mult.toString == mult.toString.reverse)
        } yield mult
    println(result.sortWith((A, B) => (A > B)).head)
  }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s