Palindrome years

Problem: This year on October 2, 2001, the date in MMDDYYYY format will be a palindrome (same forwards as backwards). 10/02/2001 when was the last date that this occurred on? (see if you can do it in your head!) Solution: we know the year has to be less than 2001 since we already have the palindrome for 10/02. it can’t be any year in 1900 because that would result in a day of 91. [Read More]

Red marbles, blue marbles

Problem You have two jars, 50 red marbles, 50 blue marbles. you need to place all the marbles into the jars such that when you blindly pick one marble out of one jar, you maximize the chances that it will be red. (when picking, you’ll first randomly pick a jar, and then randomly pick a marble out of that jar) you can arrange the marbles however you like, but each marble must be in a jar. [Read More]

Reverse a string - word by word


 
Problem: Reverse “the house is blue”, the answer should be “blue is house the”. the words are reversed, but the letters are still in order (within the word).

Solution:

The solution can be attained by first reversing the string normally, and then just reversing each word.

initial: the house is blue

reverse: eulb si esuoh eht


  

Now reverse the word at its place  

initial: the house is blue

reverse: eulb si esuoh eht

wanted : blue is house the