Had at work day and night, it counts the numbers over and over. Although it counts all its life, it never gets past twelve.
A boat has a ladder that has six rungs, each rung is one foot apart. The bottom rung is one foot from the water. The tide rises at 12 inches every 15 minutes. High tide peaks in one hour. When the tide is at it's highest, how many rungs are under water?
None, the boat rises with the tide. logicmathshort
A man gave one son 10 cents and another son was given 15 cents. What time is it?
1:45. The man gave away a total of 25 cents. He divided it between two people. Therefore, he gave a quarter to two.logicmathshort
Is half of two plus two equal to two or three?
Three. It seems that it could almost be either, but if you follow the mathematical orders of operation, division is performed before addition. So... half of two is one. Then add two, and the answer is three.logicshort
Tommy Tucker took two strings and tied two turtles to two tall trees. How many T’s in that?
There are 2 t’s in THAT.cleanlogicshortwhat am I
Wash it and it isn't clean. Don't wash it and then it's clean. What I Am?
A swan sits at the center of a perfectly circular lake. At an edge of the lake stands a ravenous monster waiting to devour the swan. The monster can not enter the water, but it will run around the circumference of the lake to try to catch the swan as soon as it reaches the shore. The monster moves at 4 times the speed of the swan, and it will always move in the direction along the shore that brings it closer to the swan the quickest. Both the swan and the the monster can change directions in an instant.
The swan knows that if it can reach the lake's shore without the monster right on top of it, it can instantly escape into the surrounding forest.
How can the swan succesfully escape?
Assume the radius of the lake is R feet. So the circumference of the lake is (2*pi*R). If the swan swims R/4 feet, (or, put another way, 0.25R feet) straight away from the center of the lake, and then begins swimming in a circle around the center, then it will be able to swim around this circle in the exact same amount of time as the monster will be able to run around the lake's shore (since this inner circle's circumference is 2*pi*(R/4), which is exactly 4 times shorter than the shore's circumference).
From this point, the swan can move a millimeter inward toward the lake's center, and begin swimming around the center in a circle from this distance. It is now going around a very slightly smaller circle than it was a moment ago, and thus will be able to swim around this circle FASTER than the monster can run around the shore.
The swan can keep swimming around this way, pulling further away each second, until finally it is on the opposite side of its inner circle from where the monster is on the shore. At this point, the swan aims directly toward the closest shore and begins swimming that way. At this point, the swan has to swim [0.75R feet + 1 millimeter] to get to shore. Meanwhile, the monster will have to run R*pi feet (half the circumference of the lake) to get to where the swan is headed.
The monster runs four times as fast as the swan, but you can see that it has more than four times as far to run:
[0.75R feet + 1 millimeter] * 4 < R*pi
[This math could actually be incorrect if R were very very small, but in that case we could just say the swan swam inward even less than a millimeter, and make the math work out correctly.]
Because the swan has less than a fourth of the distance to travel as the monster, it will reach the shore before the monster reaches where it is and successfully escape.logicmath
You are somewhere on Earth. You walk due south 1 mile, then due east 1 mile, then due north 1 mile. When you finish this 3-mile walk, you are back exactly where you started.
It turns out there are an infinite number of different points on earth where you might be. Can you describe them all?
It's important to note that this set of points should contain both an infinite number of different latitudes, and an infinite number of different longitudes (though the same latitudes and longitudes can be repeated multiple times); if it doesn't, you haven't thought of all the points.
One of the points is the North Pole. If you go south one mile, and then east one mile, you're still exactly one mile south of the North Pole, so you'll be back where you started when you go north one mile.
To think of the next set of points, imagine the latitude slighty north of the South Pole, where the length of the longitudinal line around the Earth is exactly one mile (put another way, imagine the latitude slightly north of the South Pole where if you were to walk due east one mile, you would end up exactly where you started). Any point exactly one mile north of this latitude is another one of the points you could be at, because you would walk south one mile, then walk east a mile around and end up where you started the eastward walk, and then walk back north one mile to your starting point. So this adds an infinite number of other points we could be at. However, we have not yet met the requirement that our set of points has an infinite number of different latitudes.
To meet this requirement and see the rest of the points you might be at, we just generalize the previous set of points. Imagine the latitude slightly north of the South Pole that is 1/2 mile in distance. Also imagine the latitudes in this area that are 1/3 miles in distance, 1/4 miles in distance, 1/5 miles, 1/6 miles, and so on. If you are at any of these latitudes and you walk exactly one mile east, you will end up exactly where you started. Thus, any point that is one mile north of ANY of these latitudes is another one of the points you might have started at, since you'll walk one mile south, then one mile east and end up where you started your eastward walk, and finally, one mile north back to where you started.logicmath
You can easily "tile" an 8x8 chessboard with 32 2x1 tiles, meaning that you can place these 32 tiles on the board and cover every square.
But if you take away two opposite corners from the chessboard, it becomes impossible to tile this new 62-square board.
Can you explain why tiling this board isn't possible?
Color in the chessboard, alternating with red and blue tiles. Then color all of your tiles half red and half blue. Whenever you place a tile down, you can always make it so that the red part of the tile is on a red square and the blue part of the tile is on the blue square.
Since you'll need to place 31 tiles on the board (to cover the 62 squares), you would have to be able to cover 31 red squares and 31 blue squares. But when you took away the two corners, you can see that you are taking away two red spaces, leaving 30 red squares and 32 blue squares. There is no way to cover 30 red squares and 32 blue squares with the 31 tiles, since these tiles can only cover 31 red squares and 31 blue squares, and thus, tiling this board is not possible.logicmath
Two words are anagrams if and only if they contain the exact same letters with the exact same frequency (for example, "name" and "mean" are anagrams, but "red" and "deer" are not).
Given two strings S1 and S2, which each only contain the lowercase letters a through z, write a program to determine if S1 and S2 are anagrams. The program must have a running time of O(n + m), where n and m are the lengths of S1 and S2, respectively, and it must have O(1) (constant) space usage.
First create an array A of length 26, representing the counts of each letter of the alphabet, with each value initialized to 0. Iterate through each character in S1 and add 1 to the corresponding entry in A. Once this iteration is complete, A will contain the counts for the letters in S1. Then, iterate through each character in S2, and subtract 1 from each corresponding entry in A. Now, if the each entry in A is 0, then S1 and S2 are anagrams; otherwise, S1 and S2 aren't anagrams.
Here is pseudocode for the procedure that was described:
def areAnagrams(S1, S2)
A = new Array(26)
for each character in S1
arrayIndex = mapCharacterToNumber(character) //maps "a" to 0, "b" to 1, "c" to 2, etc...
A[arrayIndex] += 1
for each character in S2
arrayIndex = mapCharacterToNumber(character)
A[arrayIndex] -= 1
for (i = 0; i < 26; i++)
if A[i] != 0