0

I have a 2D array of the form:

scala> signature_matrix
res129: Array[Array[Int]]

How do I find the maximum element?

2 Answers 2

5

flatten to a 1d list, then call max:

arr.flatten.max
Sign up to request clarification or add additional context in comments.

Comments

1
signature_matrix.map(_.max).max

find sub Array max firstly and map to an Array, and find max again.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.