Company: phonepe_1aug
Difficulty: medium
Fair Contestant Pairs Problem Description In a reality game show, there are n contestants standing in a line. Each contestant has been assigned two attributes: A score, representing their performance in the game so far. A popularity index based on audience votes. After some rounds, the show's producers want to check if the perceived differences in scores between any two contestants are justified by their popularity — to ensure fairness and transparency. You are given two integer arrays of size n : score[i] — the current score of the i-th contestant popularity[i] — the popularity index of the i-th contestant There is also an integer constant k , which represents the tolerance the producers are willing to allow in the mismatch between score difference and popularity difference. The producers want to find out how many pairs of contestants (i, j) (with i ) satisfy the following condition: score[j] - score[i] Your task is to compute the total number of such valid pairs. Input Format: An int