Your question is Sort Array of 0s and 1s. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Blue Yonder's Luminate planning workflows can represent a binary allocation flag as 0 or 1. Given an array containing only these values, sort it in ascending order so every 0 appears before every 1.
Modify the array in place and return the same array. Do not use Python's built-in sorting method. Aim for a single linear scan and constant extra space.
nums, a mutable array of integers containing only 0 and 1.nums array, containing all 0s before all 1s.def sort_binary_array(nums):