How to find max and min elements in a set with Scala

1 Answer

0 votes
object MyClass {
    def main(args: Array[String]): Unit = {
        var st : Set[Int] = Set(1, 4, 5, 1, 9, 2, 8, 0, 7, 6);
         
        println(st.min);
        println(st.max);
    }
}
 
 
 
 
/*
run:
 
0
9
 
*/

 



answered Jun 2, 2021 by avibootz

Related questions

1 answer 166 views
3 answers 110 views
1 answer 54 views
1 answer 52 views
1 answer 84 views
...