Finding last position of a target in a sorted array with duplicates. Helps solve leetcode problem: Find First and Last Position of Element in Sorted Array