Input: L = {1, 5}, R = {3, 7}, N = 4
Output: 6
Explanation: The numbers present are {1, 2, 3, 5, 6, 7}. Therefore 4-th element(0-indexed) is 6.
Input: L = {1, 3}, R = {4, 5}, N = 3
Output: 3
Explanation: The numbers present are {1, 2, 3, 4, 3, 4, 5} and their sorted order is {1, 2, 3, 3, 4, 4, 5}. Therefore 3-rd element(0-indexed) is 3.