• 0 Posts
  • 36 Comments
Joined 2 months ago
cake
Cake day: June 6th, 2025

help-circle











  • This works for both positive and negative numbers:

    private static bool isEven(int number)
    {
    	bool result = true;
    
    	while (number < 0)
    	{
    		number = number - 1;
    		if (result == true)
    			result = false;
    		else
    			result = true;
    	}
    	while (number > 0)
    	{
    		number = number - 1;
    		if (result == true)
    			result = false;
    		else
    			result = true;
    	}
    	return result;
    }
    

    Output:

    isEven(4) = True
    isEven(5) = False
    isEven(-4) = True
    isEven(-5) = False
    








  • My hypothesis is that they hide. So I saturate all the hiding places so they have nowhere left to hide.

    When I buy something known for liking to hide, I buy N of them and place them all in a designated “I’ve got N of these things” place (P). Then I put 1 in its home. When it hides, I get its replacement. When that hides, same again. When there are none left in P, I buy N more. Eventually they have nowhere left to hide and finding one is easy. Consequently, they stop hiding.