During validation of Zscaler Internet Access policy rules, you receive an unsorted list of integer rule priorities and a target priority total. Find two distinct entries whose priorities add up to the target.
Return their zero-based indices as [i, j], where i < j. If multiple valid pairs exist, return the pair with the smallest second index. If no pair exists, return [-1, -1].
Use a hash map to avoid checking every possible pair. Explain why the map must be checked before inserting the current value.
Implement find_priority_pair(priorities, target).
priorities, a list of integers, and target, an integer.[-1, -1] when no pair exists.def find_priority_pair(priorities, target):