Code One-Liner
From Ben via a dead link:
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
What does this one-line shell command do, and how exactly does it do it?
From Ben via a dead link:
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
What does this one-line shell command do, and how exactly does it do it?
From Julio Sepia:
It takes one day for ten workers to dig ten holes.
It takes two days for five workers to dig ten holes.
How much does it take for one man to dig HALF a hole?
From Julio Sepia:
Write the number 755 as the sum of five consecutive odd numbers.
From Andreas Renberg:
A large caravan is stuck in the desert. They have enough food and water to last them a while, but still need to send someone to find help.
The nearest city is a 7 day journey, but each person is only able to carry 4 days worth of food.
What do they do so that everyone gets out alive?
From Sean Murphy:
There are 1000 switches numbered from 1 to 1000. They are all off. I begin by flicking all the switches. I then flick every second switch (2,4,6…). I then flick every third switch (3,6,9…). I repeat the process 1000 times.
How many switches are off by the time I have finished?
From fretje:
When you die, you go to this place where there are two doors: one goes to heaven, the other one goes to hell. There’s a guard in front of each door. You don’t know which door is which. The only thing you know is that one of the guards is always telling the truth, while the other one is always lying. You can ask one question to one of the guards.
How do you know which door to take to get to heaven?
From asas:
You have two 4 min fuses and a bomb. You want to be able to time the detonation of the bomb for 1min. Like the ropes puzzle, neither fuse burns at a uniform rate throughout.
How do you time your act of senseless destruction?
The setup for this puzzler is quite simple. You have an ordinary clock and the time is exactly 3:15 pm.
What is the angle between the two hands of the clock?
You are playing a game with your friend sitting across a perfectly round tabletop. You each have a supply of quarters which you will place on the table one at a time, without moving any other quarters and without overlapping. The last person who successfully puts a quarter on the table without running out of space on the table wins the game. You get the lucky break of going first.
Where should you put your quarter to ensure that you win, and why?
[Bonus Round] You don’t get to go first. Depending on where your partner puts his quarter first, where do you put your quarter second to best your odds? Can you guarantee a win or a stalemate?
You have a large selection of ropes of varying lengths. The ropes burn at different rates, even one part of a rope may burn differently than another part, but there’s no way to tell just by looking at them. What you do know is that every single rope will take exactly 1 hour to burn from one end to the other. You also have access to matches, but nothing else (obviously no clocks, etc).
How can you time exactly 30 minutes using the ropes?
Recently Answered