# Monkey and Door Problem

There are 100 doors numbered from 1 to 100, all initially closed. Nearby, there are also 100 monkeys, numbered from 1 to 100.

The first monkey opens every door that is a multiple of 1 (so it opens all doors). The second monkey then toggles (opens if closed, or closes if open) each door that is a multiple of 2. The third monkey toggles each door that is a multiple of 3, and so on, with each successive monkey toggling doors that are multiples of its own number.

This continues until all 100 monkeys have had their turn. The challenge is to determine how many doors will remain open after the 100th monkey?

  1. Try to solve this problem using java.
  2. Try to solve this problem with one single loop using java.