DEV Community


Discussion on: Sort Colors - LeetCode

ravi1512 profile image
Ravi Mishra

I implemented these two methods exactly. First one has an extra space of O(n) and the other one is constant space O(1). Runtime of both functions is O(n). This problem is also called Dutch National Flag problem.