Beautiful triplets

problem - https://hack.codingblocks.com/practice/p/373/880

Can anyone help me on how to solve it?
I tried using Binary Search and Sets, but am unable to optimize it further.
code - https://ide.geeksforgeeks.org/eCQwcwt8T6

check this https://ide.codingblocks.com/s/44789
this is code in c++ if u dont understand reply i will give in python

1 Like

Thanks a lot for your help.
Apologies though, as I just realized that I had posted the link to another problem by mistake (just corrected it now).
Nevertheless, thanks for replying again.