Tuesday, August 14, 2018

Leetcode 219. Contains Duplicate II

Introduction


It is an easy level array algorithm. I came out the time complexity O(N) solution where N is the total number of element in the array. I decided to write the algorithm. And then I studied discuss and the solution can be simplified.

I simplified the code from using Dictionary<int, HashSet<int>> to Dictionary<int, int>, and then continue to simplify using HashSet<int>.

My practice


Here is my C# code folder.


No comments:

Post a Comment