Thanks again to Pallav for the puzzle – as I mentioned earlier, one of my favorites and a wonderful concept of mathematical induction to be taught to children. Only two people sent correct answers – Mohit Khare and Pratik Poddar – well done!
The answer is 23 days. For such puzzles, one can try a smaller problem first – i.e. what happens if there is only one person will yellow eyes, then for 2 and so on. Here is how it works (copying answer from Pratik Poddar directly):
Everyone knows that there is at least one diseased guy. Lets say that there was 1 diseased guy. That guy would see that there is no one else, and move out on day 1. If there were two diseased guys, no one would move out on day 1, as both think that there is someone else who is diseased. So, on day 2, both realise that both are diseased. Similarly, till day 22, all diseased people would be thinking that there are 22 diseased, and all will leave on day 22. But when no one leaves, all 23 diseased people leave on day 23.
Hope you enjoyed the puzzle!