Question bank › Two Pointers
Dsa Two Pointers Hard

Find Largest Distinct Subarray Sum

Given an array of integers, find the largest sum of a contiguous subarray that contains no duplicate numbers. You must implement your solution using the two pointers technique. If there are no elements in the array, return 0. The function should read from standard input and print the result. Example: Input: 5 1 2 3 2 5 Output: 11 Explanation: The largest subarray without duplicates is [1, 2, 3, 2, 5] with a sum of 11.

Key concepts

two_pointerssubarrayhashmap

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.