Implemented as part of leetcode solutions