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):