In this video I have solved count triplets from the hackerrank interview preparation kit playlist using 2 approaches.
for this particular solution I have used two maps and stored the possible values of ar and ar2 in them so that we can solve this problem in one go and with least time complexity possible;
The video has following chapter if you understand logic in first go you can see code directly.
if you are someone who is trying to solve all the problems from hackerrank interview preparation kit playlist and getting stuck anywhere or looking for optimized solution do check my playlist
• Hackerrank Interview Preparation Kit
0:00 Start
2:08 naive approach /brute force
5:04 building logic with finding no of pairs
9:34 first example for triplet explanation
13:07 second example for triplet explanation
17:05 actual code writing in hackerrank portal