ServiceNow coding interview round for System Engineer and Senior System Engineer

Anonymous User
695
Jun 21, 2025
Jun 21, 2025

Hi,
gave a coding interview round for service Now on 20th june for System Engineer and Senior System Engineer role

the test was conducted on hacker rank.
Only one problem(not sure if their were others , was not able to solve this.)

Problem: Longest Subarray
a subarray of array a is defined as a contiguous block of a’s elements having a length that is less than or equal to the length of the array. For example, the subarrays of array a = {1, 2, 3} are [1], [2], [3], [1, 2], [2, 3], and [1, 2, 3].

Given an integer k = 3, the subarrays having elements that sum to a number ≤ k are [1], [2], and [1, 2]. The longest of these subarrays is [1, 2], which has a length of 2.

Given an array a, determine the longest subarray that sums to less than or equal to a given value k.

Comments (1)