Answer: PRATT and WHITNEY Hiring Challenge | Online Assessment Question | On-Campus(2023

Answer · Posted Jun 2026

Approach Traverse every element in arr1. Compare it with every element in arr2. If any difference is less than or equal to d, mark it as invalid. Otherwise, count it. Strategy Use nested loops. For each element in arr1, verify that all elements in arr2 satisfy the required condition. Increment the answer only if the element is valid. Java Code class Solution { public int findTheDistanceValue(int[] arr1, int[] arr2, int d) { int count = 0; for (int num1 : ...

The full answer & interview discussion are available to premium members.

Log in Create a free account