Find Largest Number

Easy2s max execution

Implement a method that finds the largest number in an array of integers.

📝 Requirements:

  1. Input constraints:
    • The array numbers contains only integers
    • The array always contains at least one element
    • The array will never contain more than 10 elements
  2. Value constraints:
    • All integers are between -2³¹ and 2³¹-1 (32-bit integers)

💡 Example:

For the array [43, -19, 75, 1]:

  • The largest number is 75
  • Return value should be 75

🎯 Your Task:

Complete the solve method that takes an array of numbers and returns the largest value in that array.

Examples:

Input: [43, -19, 75, 1]
Output: 75

75 is the largest number in the array

Input: [-5, -10, -2, -1]
Output: -1

-1 is the largest number among negative numbers

Input: [42]
Output: 42

When there's only one number, it's the largest by default

Constraints:

  • 1 ≤ array.length ≤ 10
  • -2³¹ ≤ numbers[i] ≤ 2³¹-1
  • Array contains at least one element
  • All numbers are integers
Loading...

Custom Test Input

Output

Run your code to see output...