Maximize value of a pair from two given arrays based on given conditions
Given two arrays A[] and B[] consisting of N integers and an integer K, the task is to find the maximum value of B[i] + B[j] + abs(A[i] - A[j]) by choosing any pair (i, j) such that abs(A[i] - A[j]) ? K. Examples: Input: A[] = {5, 6, 9, 10}, B[] = {3, 0, 10, -10}, K = 1Output: 4Explanation:Only two