Autodesk Interview Question

Medium difficult leet code sorting