ServiceNow | 2026 | Stock Trend Analysis | Capable Models

ServiceNow · Question · Posted Apr 2026

Question 1: Stock Trend Analysis Problem Statement: The traders in Hackerland want to study the upward trends in stock prices. Given an array of n integers called prices, for each element, find an array of integers where the i-th element represents the index of the k-th next greater element for the corresponding element in the given array, or -1 if it does not exist. Assume that indexing starts from 1. Note: The k-th next greater element for any element x ...

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

Log in Create a free account