TLE occurring in both cases

I tried O(n^2) approach still TLE occurs is there a better way to perform this?

@vijit.chandhok99 Hey Vijit, For array-target-sum-triplet Problem there is a video of Target Sum Triplet Hint available. In that video the hint of the solution is given which is O(n^2). we can optimize this problem minimum upto O(n^2). I think there may be a mistake in your code.