Tap here to switch tabs
Problem
Submissions

Problem: Identify the Largest Outlier in an Array

Identify the Largest Outlier in an Array gives an integer array where all but two values are special: one remaining value is their sum. Return the largest possible outlier.

Statement

You are given an integer array nums with n elements, where exactly n - 2 elements are special numbers. Among the remaining two elements, one is the sum of all special numbers, and the other is the outlier.

An outlier is an element that is neither a special number nor the sum of the special numbers. Your task is to return the largest possible outlier in nums.

Note: The special numbers, the sum element, and the outlier must be located at distinct indices, but they may have the same value.

Constraints:

  • 3≤3 \leq nums.length ≤105\leq 10^5

  • −1000≤-1000 \leq nums[i] ≤1000\leq 1000

  • The input is generated such that at least one potential outlier exists in nums.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Identify the Largest Outlier in an Array

Identify the Largest Outlier in an Array gives an integer array where all but two values are special: one remaining value is their sum. Return the largest possible outlier.

Statement

You are given an integer array nums with n elements, where exactly n - 2 elements are special numbers. Among the remaining two elements, one is the sum of all special numbers, and the other is the outlier.

An outlier is an element that is neither a special number nor the sum of the special numbers. Your task is to return the largest possible outlier in nums.

Note: The special numbers, the sum element, and the outlier must be located at distinct indices, but they may have the same value.

Constraints:

  • 3≤3 \leq nums.length ≤105\leq 10^5

  • −1000≤-1000 \leq nums[i] ≤1000\leq 1000

  • The input is generated such that at least one potential outlier exists in nums.