\\Ref: https://www.geeksforgeeks.org/leaders-in-an-array/
1.#include <iostream>
2.using namespace std;
3.void printLeaders(int arr[], int size)
4.{ int max_from_right = arr[size-1];
5. /* Rightmost element is always leader */
6. cout << max_from_right << " ";
7. for (int i = size-2; i >= 0; i--)
8.{ if (max_from_right <= arr[i])
9. { max_from_right = arr[i];
10. cout << max_from_right << " "; }}}
11.int main()
12.{ int arr[] = {16, 17, 4, 3, 5, 2};
13. int n = sizeof(arr)/sizeof(arr[0]);
14. printLeaders(arr, n);
15. return 0; }
for loop will execute 5th and 6th time also without making any changes and after that, the function will return. So $2,5,17$ are the leaders displayed in the o/p. Answer : B