Get the App
SLTechnology News&Howtos  ›  Servers  › 

Recursively find the maximum of the array

Shulou Source: shulou.com Published: 2022-06-03 04:51:51 10月04日 Update

An offline test question for iFLYTEK

I have never been familiar with recursion.

Topic: find the maximum value of a sequence, using recursive form

Public class blanket {public static void main (String [] args) {int [] a = {1, 9, 5, 5, 7, 4, 6, 12, 435, 67, 23, 232, 56454, 5}; int max1 = max (max1 0); System.out.println (max1); / / return max1 } public static int max (int [] an index int index,int max) {if (index = = a.length) return max; max = Math.max (max, a [index]); index++; return max (a meme indexist max);}}

It's just a nonsense. I didn't expect it to be possible. very pleased. Ask the boss for advice on what can be changed.

Tags: Recursion maximum maximum unexpected place form series questions questions boss iFLYTEK array Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MariaDB OPPO Reno Microsoft NVidia