← Microsoft questions

Replace each array element with its farthest coprime

Filed under Microsoft

Given an array of n integers, for each element, find the integer in the range [2, 250] that is coprime to it and has the maximum absolute difference from the original element.

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 Microsoft questions

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