Largest K such that both K and -K exist in array - Company-specific OAs / Microsoft OA

Given an array A of N integers, returns the largest integer K > 0 such that both values K and -K exist in array A. If there is no such integer, the function should return 0.

This is a companion discussion topic for the original entry at