ServiceNow ASE OA 2025| Maximum Mountain Subsequence & Number of Possible Arrays

ServiceNow · Question · Posted Jun 2026

Problem 1 - Maximum Mountain Subsequence of Size 3 Problem Statement Given an integer array arr, find three elements: a = arr[i] b = arr[j] c = arr[k] such that: i < j < k a < b b > c The three elements form a mountain subsequence. Return the maximum possible value of: a + b + c If no valid mountain subsequence exists, return -1. Constraints Constraint 3 ≤ N ≤ 105 -109 ≤ arr[i] ≤ 109 Test ...

The full answer & interview discussion are available to premium members.

Log in Create a free account