Samsung Research America interview question

Coding: Array problem to find max distance amongst elements based on some criteria