I have solved the above question in t.c n2; it can be soved using two pointers approach?

can the above probelm van be solved using two pointers approach or less than n2 time complexity

hi @itzzeeshu5, 2 pointer will not be useful here