← BNY Mellon questions
CodingReported in a candidate post, Apr 2022

Distance to duplicate elements

Filed under BNY Mellon

Given an integer array `arr`, for each element at index `i`, calculate the sum of absolute distances `|i - j|` to all other indices `j` such that `arr[i] == arr[j]`. Return an array of the same length…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related BNY Mellon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.