← Contains Duplicate
Discussions
Sign in to join the discussion.
K
kmalhotra
OFFICIAL
3 months, 1 week ago
Clean C++ solution, beats most submissions.
A single pass with a running value is enough here. Keep track of the best answer so far and update it as you scan, which gives O(n) time and O(1) extra space.
💬 1 reply
S
sanjanasub6
1 month ago
Asked in my PhonePe OA last week.
A single pass with a running value is enough here. Keep track of the best answer so far and update it as you scan, which gives O(n) time and O(1) extra space.
💬 1 reply
V
vaishnavi.b
2 months, 1 week ago
Intuition + complexity breakdown for Contains Duplicate.
A single pass with a running value is enough here. Keep track of the best answer so far and update it as you scan, which gives O(n) time and O(1) extra space.
💬 1 reply
R
ritika_24
4 months, 1 week ago
Intuition + complexity breakdown for Contains Duplicate.
A single pass with a running value is enough here. Keep track of the best answer so far and update it as you scan, which gives O(n) time and O(1) extra space.
💬 0 replies