Leetcode doubts

In this problem the time complexity in brute force is O(n^4)
also can we use the kadane’s algo here.If yes then how to implement it??Also how to return the ans in form of nested
array in c++

kadan algorithm is used to find max sum of subarray of a given array

but in this question you have to find 4 pairs of number such that there sum is equal to target

nested array in c++ can be implemented using
vector of vector

Sorry Sorry for my imistake,Now whatis the implementayion of this roblem

i have used 4 pointer approach here
first two pointer start from starting
and then next two pointer starts at starting and ending of remaining array

for avoiding duplicate ans we have to increase the pointers effectively

(here pointers means variable which points to array elment)

Reference Code

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.