How to find the longest string size of an array of strings in Scala

1 Answer

0 votes
object LongestStringSize extends App {
  val strings = Array("c++", "python", "c#", "golang", "scala", "java")
  
  val longestStringSize = strings.map(_.length).max
  
  println(longestStringSize)
}



/*
run:

6

*/

 



answered Oct 2, 2024 by avibootz
...