Math + Problem Solving Flashcards
x % 2 === 0
Easy way to determine x is an even number
Math.floor(Math.random() * 6 + 1);
Find number between 0 and 6
[margin] 100 * 42.85714%
Finding a margin that is the % value of 3/7. This would be used to find the margin if you’re looking to fill up 3/7 of a row (flexbox)
1.61803
float that equals/represents golden ratio.
used in Flexbox Starter Course #4 to set flex-grow and flex-shrink for the bigger portion of golden ratio layout
1 / (1 + 1 + 1)
Flexbox adds the values for the properties and then divide each column’s value by that sum. So each column takes up 1 ÷ (1 + 1 + 1), or ⅓ of the total space.
If the first integer was 4, it would be 4 / (4 + 1 + 1) which = 4/6 or 2/3 of total space.
Used in:
.column { flex: 1 1 0; }
Quickest way to find the halfway point between two numbers, a and b.
(a + b) / 2
Why are manhole covers round?
Because they’ll roll and they can’t fall down the hole. And because manholes are round.
There are three switches in one room and one light bulb in another. How can you tell which switch controls the bulb if you can only make one trip from the switch room to the bulb room?
Turn on two switches, wait a while and turn one off. If the bulb is on, it’s the one left on. If the bulb is off and warm, it was the one you switched off. Otherwise it’s the one you didn’t touch.
If a plane crashes right on the border of the US and Canada, in which country would you bury the survivors?
You don’t bury survivors.
You have two fuses which burn unevenly (not at a constant rate). You do know that it takes one minute for each fuse to burn completely when lit at one end. How do you measure 45 seconds?
Light both ends of fuse one and one end of fuse two. When fuse one burns out, light the other end of fuse two.
You have four people (A, B, C & D) who have to cross a bridge. One or two can cross at once and they travel at the speed of the slower person. There’s one flashlight which is needed to cross the bridge. A takes one minute, B takes two minutes, C takes five minutes and D takes ten minutes to cross. How do you get all of the people across in 17 minutes?
A and B cross, A comes back, C and D cross, B comes back, A and B cross.
How far apart are the hands of a clock at 3:15?
They’re seven and a half degrees apart.
Tell me one of your faults.
Sometimes I’m too much of a perfectionist and I expect too much from my teammates.
First 13 numbers in Fibonacci sequence
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
Divide and conquer
Recursively breaking down a problem into two or more sub-problems of the same (or related) type (divide), until these become simple enough to be solved directly.
The solutions to the sub-problems are then combined to give a solution to the original problem.