netapp logo
NetApp· Full Stack Engineer

NetApp Full Stack Engineer

Posted
10 Oct 2026
436 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.

How it went

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

Questions asked (1)

  1. 01

    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.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at NetApp recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

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