Get Triple Count
Problem Overview
- Count distinct triplets (i<j<k) in an array whose sum is divisible by d.
- Input: arr of stock prices and integer d; Output: integer count; constraints: 3<=n<=10^3, 1<=arr[i]<=10^9, 2<=d<=10^6.
- Real-world context: selecting three days to buy stocks where their total cost meets a divisibility rule.
- From Ibm interviews; an interview question commonly used in a coding interview and posed as a screening problem.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
