cswork / OAOpen practice workspace

WeRideOA #2

Distance Metric

Estimated MediumStatement and editorial — judging is being prepared

Topics (AI-labelled)HashingPrefix & Ranges

For each element in a given array, calculate the absolute value of index differences between it and all other elements of the same value. Return the resulting values in an array. For example, if the array elements at indices 2 and 3 are equal, the distance metric for element 2 is |2-3| = 1. For element 3 it is |3-2| = 1.

Editorial

Loading solution…