O(n)
After removing a candidate x for the outlier, we need to check if the remaining sum is the double of some value y.
After removing a candidate $x$ for the outlier, we need to check if the remaining sum is the double of some value $y$.

```rust []
use std::collections::{BTreeSet, HashMap};

impl Solution {
    pub fn get_largest_outlier(nums: Vec<i32>) -> i32 {

        let dbl = nums.iter()
            .enumerate()
            .fold(HashMap::<i32, Vec<usize>>::new(), |mut dbl, (i, &x)| {
                dbl.entry(2*x).or_default().push(i);
                dbl
            });

        let mut res = None;
        let total = nums.iter().sum::<i32>();
        for (i, x) in nums.into_iter().enumerate() {
            let y = total - x;
            if dbl.contains_key(&y) && dbl[&y] != vec![i] {
                res = res.max(Some(x))
            }
        }
        res.unwrap()
    }
}
```
['Rust']