How to find largest element in an array without using sorting !!!
Blog post description.How to find largest element in an array without using sorting !!!
Mohan Pardhi
5/15/20261 min read


Most beginners solve this in 3 lines of code.
And most of those 3 lines are wrong. 😅
—
Here's a tiny Python problem that quietly trips up every fresher in interviews:
“Find the largest element in an array.”
Sounds easy, right?
Most people instantly reach for sort() and return the last element. It works… but it's O(n log n).
And then the interviewer leans in and says:
“Can you do it without sorting?”
That's where 70% of candidates freeze.
In the next video of our DSA in Python series, we break this down step by step:
✅ Why “sort and pick” is the WRONG default mindset
✅ The O(n) one-pass approach every interviewer expects
✅ The hidden trap of initializing largest = 0 (it fails for negative arrays!)
✅ Edge cases: empty arrays, duplicates, all negatives
✅ The Pythonic shortcut — and when NOT to use it
This is exactly the kind of “simple” problem that decides whether you get the offer or not.
🎥 Watch the full breakdown here:
https://www.youtube.com/watch?v=ThOBls_zRgg
If you're preparing for placements, coding interviews, or just starting your DSA journey — this 7-minute video will save you from making the most common beginner mistake.
Drop a 👍 if you've ever instinctively reached for sort() when you didn't need to.
And tell me in the comments — what time complexity did YOU guess before clicking?
—
Mohan Pardhi
Co-founder, WeGrad
We help students learn from people who've actually walked the path.
