PICKING PERFECT TRIO

i am unable to implement it.
what data structure is best??

This is the same problem i guess:
Problem:

Editorial:

1 Like

Wow ,its the same problem. Thank you so much