Company: Tiger_Analytics_9jan
Difficulty: medium
Searching Algorithms: Lovely Elements Problem Description You are given an array A of integers of size N and two integers K and P . An i th element of an array is said to be a lovely element if it satisfies one of the following conditions: (K - A[i]) is present in the given array A . (P + A[i]) is present in the given array A (where 0 <= i < N ). Print the total number of lovely elements in the array A . Note: Consider 0-based indexing. Input Format The first line contains an integer N , denoting the length of the array A . The second line contains N space-separated integers, denoting the elements of the array A . The third line contains an integer K , denoting the value of K . The fourth line contains an integer P , denoting the value of P . Output Format The output contains an integer denoting the total number of lovely elements in the array A . Constraints 2 <= N <= 100 -10 5 <= A[i] <= 10 5 1 <= K <= 100 1 <= P <= 100 Sample 1 Input 6 8 5 3 7 8 12 2 1