Largest Element in an Array
Updated
Problem statement
You are given a non-empty integer array numbers. Return the largest value present in the array.
Function
largestElement(numbers: int[]) → intExamples
Example 1
numbers = [3,7,2,9,4]return = 99 is greater than every other value in the array.
Example 2
numbers = [-5,-2,-9]return = -2Among the negative values, -2 is the largest.
Example 3
numbers = [6]return = 6The only element is also the maximum.
Constraints
1 <= numbers.length <= 100000-10^9 <= numbers[i] <= 10^9
More Deloitte Online Assessment questions
- Seventh Nearest PalindromeOA · Seen May 2026
- Minimum Deletions for a Non-PalindromeOA · Seen Jul 2025
- Minimum-Cost Solar Rooftop AllocationOA · Seen Jul 2025
- Pair Elements with Even SumsOA · Seen Jul 2025
- Count Divisible PermutationsOA · Seen Jan 2025
- Install Carbon FiltersOA · Seen Oct 2023
- Longest Substring with Even OccurrencesOA · Seen Oct 2023
- Maximum Sum RectangleOA · Seen Apr 2022
- Annual Bank Balance with Monthly Card FeesOA · Seen Jan 2022
- Count Battleships by SizeOA · Seen Jan 2022
Similar questions at other companies
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Count Valid Square PairsAuxoAI · OA
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Two SumAmazon · OA · PHONE SCREEN
- Count Strictly Increasing Contiguous WindowsIBM · OAIBM interview questions
- Find Words That Can Be Formed by CharactersTabaPay · OA
- Server InvestmentRippling · OARippling interview questions
- Book Reading EveningsGoogle · OAGoogle interview questions
- Minimum Index Distance Between Person and CakeSnowflake · OA · PHONE SCREENSnowflake interview questions
- Basic Item DiscountsPalantir · OAPalantir interview questions