A VMware vSphere telemetry component needs to identify the first character that appears exactly once in an event label and find two metric values that add to a target threshold. Implement both operations in one function.
Given a string s, an integer array nums, and an integer target, return a dictionary with:
unique_index: the zero-based index of the first character in s whose total frequency is one, or -1 if no such character exists.two_sum: the zero-based indices of two distinct elements in nums whose values add to target, or an empty list if no pair exists. Return indices in ascending order.Character matching is case-sensitive, and indices refer to Python string positions. The same array element cannot be used twice. For this problem, assume at most one valid Two Sum pair exists.
def find_unique_and_two_sum(s, nums, target):