Panda Guru LogoPanda
Guru

Find Number Of Quadruplets - Google OA Problem Based on Hashing

Round 1

Questions: You are given an array A of size N. You have to find the number of quadruplets based on certain conditions:

  1. A[i] × A[j] = A[k] × A[l]
  2. i < j < k < l

image

Bruteforce Approach: Run 4 loops and every time check the above condition. Whenever the condition is true, simply increment the count value.

This solution will surely give TLE error but pass some test cases.

Efficient Approach given below:
Efficient Approach

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.