Your question is Sort Map and Partition Array. 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.
HCL Digital Experience configuration tools may receive unordered settings and signed priority adjustments. Implement a function that sorts a map by its numeric values and orders an integer array so negative values appear first, followed by zeros and positive values, with each group in increasing order.
Implement sort_map_and_array(mapping, nums):
mapping is a Python dictionary whose keys are strings and whose values are integers. Return a new dictionary ordered by ascending value. If two entries have the same value, order them by ascending key.nums is a list of integers. Return a new list containing all negative values first, then zero values, then positive values. Values within each group must be in increasing order. The input list must not be modified.(sorted_mapping, sorted_nums).The returned dictionary's iteration order represents the requested map order. Do not rely on input insertion order for the result's ordering.
def sort_map_and_array(mapping, nums):