Leetcode: Two Sum

Analysis

A nested for-loop is the easiest solution, but it is O(n2)
To reduce it to O(n), a hash table is used.

 

Cheng

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami