Citadel OA | Global Maximum | Citadel Online Assessment Question

Consider an array of distinct positive integers where elements are sorted in ascending order. We want to find all the subsequences of array consisting of exactly m elements. For example, given array a=[1,2,3,4], the subsequences consisting m=3 elements are [1,2,3], [1,2,4], [1,3,4], and [2,3,4]. Once we have all of the m-element subsequences, we find the value of globalMaximum using the following pseudocode:


This is a companion discussion topic for the original entry at https://algo.monster/problems/citadel-oa-global-maximum/