Hello Dev's, in this video I spoke about the Restructure an array First number, Second numbers.
Input: let arr = [2, "b", 4, "d", 3, "a", "c", "e", 5, 1];
Expected O/P is : [2, 4, 3, 5, 1, "b", "d", "a", "c", "e"];
The time complexity of your modified implementation is O(n log n) for sorting the numbers, O(m log m) for sorting the alphabets, and O(n + m) for concatenating the sorted arrays.
The overall space complexity remains O(n).
Code Git hub: https://github.com/venkatweb1234/java...
#alogrithim, #javascript, #typescript, #datastructures