First upload for leetCode, works both for duplicated and non-duplicated