Sort Colors 🐘

Input: nums = [2,0,2,1,1,0]
Output: [0,0,1,1,2,2]
Input: nums = [2,0,1]
Output: [0,1,2]
  • n == nums.length
  • 1 <= n <= 300
  • nums[i] is either 0, 1, or 2.

Solution

Android Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Visualize Weather Forecast with WebGL

JavaScript pseudo-code //pt.1

Algorithms and Data Structures Part VI

Removing memory leaks in Angular is easy

Node.Js tutorial: URL-based requests on MacOs

JavaScript Tools Every Developer Should Know

Using PureScript to create a domain-specific language for building forms with validation

4 Tips to Debug Your Code with Chrome Devtools

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tehleel Mir 🐢

Tehleel Mir 🐢

Android Developer

More from Medium

Java: First Non-Repeating Character

Lowest Common Ancestor of a Binary Search Tree 🐳

Algorithm Interview Questions 17

How To Create An Array Class in Java