Compile
Mate
Problems
Contests
Compete
Battles
Daily Challenge
Achievements
Teams
Learn
Learning Paths
Certifications
AI Tutor
Community
Social Feed
Code Reviews
Snippets
Leaderboard
Career
Job Board
Resume Scanner
Shop
Sign In
Sign Up
Problems
Contests
Battles
Daily Challenge
Achievements
Teams
Learning Paths
Certifications
AI Tutor
Social Feed
Code Reviews
Snippets
Leaderboard
Job Board
Resume Scanner
Shop
Sign In
Sign Up
← Single Number
Discussions
Sign in
to join the discussion.
P
poojamenon
1 month, 3 weeks ago
Simple approach explained for beginners. 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