Binary Search to Find Next Greater Element III
The solution to this problem boils down to finding the next greater element to N in a sorted list. Binary Search is the best mechanism here. Steps: 1/ For each element, create a sorted list of its indexes. Store in a hash table for quick access 2/ Create a helper function to find the reverse of a number (in LogN) 3/ Create a helper function to do the Binary Search and find the next greater index Code is down below, cheers, ACC. Minimum Absolute Distance Between Mirror Pairs - LeetCode ou are given an integer array nums . A mirror pair is a pair of indices (i, j) such that: 0 <= i < j < nums.length , and reverse(nums[i]) == nums[j] , where reverse(x) denotes the integer formed by reversing the digits of x . Leading zeros are omitted after reversing, for example reverse(120) = 21 . Return the minimum absolute distance between the indices of any mirror pair. The absolute distance between indices i and...