CANDIDATE INTERVIEW STORY

NetApp Full Stack Engineer

netapp logo
netapp
· Full Stack Engineer
October 10, 2026 · 11 reads

Summary

I was interviewed for a Full Stack Engineer position at NetApp and was asked a coding question about finding the maximum sum of a unique subarray.

Full Experience

Round 1

Interview Question – Maximum Sum of Unique Subarray

Given an integer array nums and an integer k, write a function to identify the highest possible sum of a subarray within nums, where:

  1. The subarray must have exactly k elements.
  2. All elements in the subarray must be unique.
  3. If no such subarray exists, return 0.

Example 1

Input:
nums = [3, 2, 2, 3, 4, 6, 7, 7, -1]
k = 4

Output:
20

Explanation:

The valid subarray with the highest sum is:

[3, 4, 6, 7]

Its sum is:

3 + 4 + 6 + 7 = 20

Example 2

Input:
nums = [5, 5, 5, 5, 5]
k = 3

Output:
0

Explanation:

Every subarray of length 3 contains duplicate elements, so no valid subarray exists.


Additional Example

Input:
nums = [3, 2, 1, 2, 4, 6, 7, 7, -1]
k = 4

The solution should consider every contiguous subarray of length 4 and select the one with:

  • exactly 4 elements
  • no duplicate elements
  • maximum sum

Interview Questions (1)

1.

Maximum Sum of Unique Subarray

Data Structures & Algorithms

Given an integer array nums and an integer k, write a function to identify the highest possible sum of a subarray within nums such that the subarray has exactly k elements, all elements are unique, and if no such subarray exists, return 0. Includes examples and constraints as described in the interview content.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!