#3371
Identify the Largest Outlier in an Array
expert · 1065 · lc medium +32 · 36.2% accepted · 225 likes · top 14%
Description
You are given an integer array nums of n elements. Exactly n - 2 of them are special numbers. One of the two remaining elements equals the sum of all special numbers, and the other is an outlier.
An outlier is an element that is neither a special number nor the sum of the special numbers.
Note: special numbers, the sum element, and the outlier must occupy distinct indices but may have equal values.
Return the largest possible outlier value in nums.
Code
1
2
3