← Contains Duplicate
Discussions
Sign in to join the discussion.
K
kmalhotra
OFFICIAL
4 months, 3 weeks 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
2 months, 2 weeks 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
3 months, 3 weeks 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
5 months, 3 weeks 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