Answer the question
In order to leave comments, you need to log in
How to find saddle point in java array?
Hello, please help me write the code for this problem, otherwise my brains are not enough.
An element of a two-dimensional array is called a saddle point if it is the smallest in its row and at the same time the largest in its column, or, conversely, is the largest in its row and the smallest in its column . For the passed two-dimensional array, create a new two-dimensional array of the same size from booleans, where true means that the corresponding element is the saddle point in the passed array.
Thank you in advance!
Answer the question
In order to leave comments, you need to log in
Elephant must be eaten in pieces:
1. Find the smallest and largest elements in the strings, create an array of the same size from booleans, where true will mean the presence of such an element.
2. Find the smallest and largest elements in the columns, create a second array of the same size from booleans, where true will mean the presence of such an element.
3. "Overlay" one array on the second with a logical "AND" - you get the desired result.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question