HALLIBURTON Hiring | On-Campus OA (2024) | Count the Hidden Sequences

Question · Posted Jun 2026

Q1: Count the Hidden Sequences Problem Statement You are given: An integer array differences, where differences[i] is the difference between consecutive elements of a hidden sequence. Two integers lower and upper representing the allowed range of values. Determine how many possible hidden sequences exist such that every element lies within [lower, upper]. Return the number of valid sequences. Example Input differences = [1,-3,4] lower = 1 upper = 6 Output 2

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

Log in Create a free account