Question 13 You are given an array arr[], which contains N integers.
Ukg technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Question 13
You are given an array arr[], which contains N integers. The task is to count the number of valid pairs present in the array. A valid pair is any two indices i and j where i < j and arr[i] - arr[j] = i - j.
Which of the following data structures is best?
Pick ONE option
Show answer & explanation
Answer: A. A) heap
Accurate technical and quantitative evaluation based on foundational principles.
Step-by-step Derivation:
Step 1: Formulate problem conditions.
Step 2: Apply logical deduction.
Step 3: Conclude correct option.