Google | onsite | India

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-01-12Added By Anonymous
Source:Ā Link
🧭 Experience: unknown
āœ… Outcome: unknown
šŸ’° Compensation: unknown
šŸ“ Location: India
šŸ¢ Company: Google
šŸŽ“ Education: unknown
šŸŽ Benefits: unknown
šŸ“… Offer Date: unknown

Question : Given an array of length N. find the number of distinct triplets (A[i],A[j],A[k]) in the array where 0<=i<j<k<N

Example : A = { 1,1,1,1,2}
Output : 2
(1,1,1) and (1,1,2).

What is the optimized approach?
Comments