Mark As Completed Discussion

To make the brute force more efficient, we will be using a very popular data structure named: Hash Table.

A hash table keeps a key-value pair in a table using a hash function. As the hash function directly returns the memory address of the value given a key, its search, insert, and delete operations are in constant O(1) time.

We will be using a hash table to store the cumulative sum of the array as a key and its ending elements index as the value.