Using Set instead of Array, set is much faster than array to search an element, O(1) complexity