BENTLEY SYSTEMS Hiring | Off Campus OA (2023) | Longest Arithmetic Subsequence
Question · Posted Jun 2026
Problem Statement Given an integer array nums, return the length of the longest arithmetic subsequence in the array. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. A subsequence is called arithmetic if the difference between every pair of consecutive elements is the same. Your task is to find the length of the longest arithmetic subsequence present in the array. Constraints 2 <= ...
The full answer & interview discussion are available to premium members.
Log in Create a free account