Hello DIMAKATSO BOPAPE!

You’re almost there! The flaw in your solution is that you decided to use a List. The worst case time complexity of a checking if something exists in an Array or List (i.e. the contains method) is O(n). So effectively, you have a for loop which has time complexity of O(n) and then inside it you have another O(n) loop to check if sum — num exists in the List, thus the total time complexity of your solution is O(n²). I would suggest that you use a “Hash”ed data structure like a HashSet. That would decrease the total time complexity to O(n). Good luck! — If you need more information about time complexities in data structures in Java, here they are.

Talking about money, tech and how to make money from tech. Bitclout: https://bitclout.com/u/angad

Talking about money, tech and how to make money from tech. Bitclout: https://bitclout.com/u/angad