Ask HN: Examples of very basic concepts worth internalizing?

3 points by pixelperfect ↗ HN
I often see people have to think for 7+ seconds to answer this sort of question:

How many integers are in the range [2, 10]?

How many integers are in the range (3, 18)?

How many integers are in the range [4, 9)?

In my opinion, it's worthwhile for any programmer to internalize this to the point they don't have to think. Just know this:

- The number of integers in an inclusive range is 1 more than the difference

- The number of integers in an exclusive range is 1 less than the difference

- The number of integers in a range inclusive on one side is the difference.

Are there any other examples of very basic concepts worth internalizing that some people seem to miss?

1 comment

[ 1.9 ms ] story [ 11.1 ms ] thread
Powers of 2 is a big one for me.