[LeetCode] 75. Sort Colors (JavaScript)


[LeetCode] 75. Sort Colors (JavaScript)

https://leetcode.com/problems/sort-colors/ Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com sort메서드 없이 정렬을 하는 문제였다. 단 nums 레퍼런스는 유지해야하는 문제였다. 특정 소트를 짜서 풀려 하였으나 들어올 수 있는 원소가 0,1,2밖에 없는 것 때문에 그렇게 하지 않아도 풀 수 있는 문제였다. /** * @param {number[]} nums * @return {void} Do not return anything, modify nums in-place instead. */ let sortColors = function (nums) { let zero = 0; let one = 0; let two = 0; le...


#leetcodesortcolors #leetcodesortcolors자바스크립트

원문링크 : [LeetCode] 75. Sort Colors (JavaScript)