A curated list of common C++ pitfalls that you should avoid learning about the hard way.

Photo by Bankim Desai on Unsplash

While C++ is my favourite programming language for reasons that range from complete control, low-level memory access and the underlying trust-the-programmer philosophy of the language design, these are the very same reasons that have given me bugs that I have lost my sleep over and cost me hundreds in codeforces’ negative delta. While these may look childish at first, when you are writing full-fledged code, these will be hard to isolate and will cost precious time that could otherwise be used in problem-solving and……


My rant about what’s wrong with how it’s taught and an unorthodox introduction to Dynamic Programming.

Photo by Blake Connally on Unsplash

The Problem Statement.

We are given an array of integers nums[]and our task is to determine the maximum sum we can obtain by selecting a contiguous segment of the array and do it in O(n)time. To lead by example:

nums[] = {-1, 2, 3, -4, 5}
^ ^
start end
output : 6

Here is a link to the LeetCode problem. This problem is often introduced as an introductory one in a DSA101 and in other beginner algorithmic classes.

The Established Solution

Right off…

Ayush Verma

Engineer-in-making by the day, hobbyist writer by the night. A bit of both during weekends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store