Please explain how the time complexity will be O(N^3) using brute force approach in the above approach.
@jayasmit98 subarray is same as substring so for that you have to put 3 loops meaning n cube