Java – the array finds the second highest value

I have an array of 10 integer values Now I want to find out

Solution

No, it's totally impossible If you do not view all the data, you cannot know the second highest value

Of course, you don't have to sort all the data, which may be what your interviewer means - but you do need to view all the elements at least once Each element may change the result, so it needs to be checked

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>