Why does brute force sol(O(n) or O(n/2)) exceed time limit but when we add all elements from one list to another it doesn't?


#1

When we use add function in arrayList to add all the elements of one list to another which will give O(n) complexity. Then why is this solution acceptable while brute force isn’t?