Week With Aniket Issue #1 - I'm Stuck! Can You Give Me a Pointer?

Hi ,

This is the first issue of my weekly newsletter. Are you as excited as I am? I know you are.


This week's programming topic is - Pointers in C.

Have you been confused and agitated and frustrated by pointers in C? Well, no more of that! I wrote a detailed article on pointers containing everything you need to understand and use them.

Pointers in C | Aniket Bhattacharyea's Blog

Pointers in C | Aniket Bhattacharyea's Blogheraldofsolace.hashnode.devLearn the fundamentals of pointers in C in this huge post - from beginner to advanced. Write efficient programs with pointers and you will never have to wor

A few places you can study pointers from -

  1. The C Programming language by Kernighan and Ritchie - the definitive C experience.
  2. This YouTube course by freeCodeCamp.

Weekly Challenge

Write a C function void reverse_string(char *str) that takes a C-string and reverses it in place.

Submit your answer by replying to this email, or you can make a GitHub gist with your answer and send me the link.


This week's Mathematics topic is - Pigeonhole Principle.

The Pigeonhole principle states that if you have n boxes and more than n pigeons then when you put the pigeons into the holes, there must be one hole that contains more than one pigeon.

Seems obvious, but it has a tremendous impact on Mathematics. Many results can be proved using this principle and some of them are frankly pretty cool. Here's one of my favorites -

In a party of n people, some of them shake hands with others. Prove that there are at least two people with the same number of handshakes

Answer: The minimum number of handshakes is 0 and the maximum is n-1 for an individual. The number of handshakes of any person must be between these two numbers. So if you imagine the numbers are holes and the people are pigeons, then can you apply the Pigeonhole principle? Not quite, because there are n people and n possible numbers.

But observe that if 0 is the number of handshakes for someone, then they have not shaken hands with anyone else. Then there can be no one with n-1 handshakes. Similarly, if someone has n-1 handshakes then there can be no one with 0 handshakes. So, you actually have less than n possible numbers. Fewer holes, more pigeons!! You are done!

  1. This slide by Stanford University - a huge collection of important implications.
  2. Challenge and Thrill of pre-college Mathematics - One of my favorite books that I used to learn the Pigeonhole principle. Has some other interesting topics too.
  3. An Excursion in Mathematics - Again, one of the books I used to learn. Contains many interesting topics.
  4. The page in Brilliant.

Weekly Challenge

In a party of 6 people, every pair is either mutual friends or mutual enemies. (i. e. everyone knows everyone else and is either friend or enemy). Prove that there exist 3 people who are all friends or there exist 3 people who are all enemies. Also, prove that this is not true for 5 people.

This is an interesting problem which I will talk about more in the next week.

Submit your answer by replying to this email.

The End

That's all for this week. See you again next Monday.

You can submit a comment as answers to the challenges.

Aniket Bhattacharyea

Aniket Bhattacharyea