Hey friends!
I hope you had a great week! Let's get scootin.
Web links of the week
date-fns
Learn to build your own desktop chat app with React and Electron, one step at a time
ml5.js: Friendly Machine Learning for the Web
The React is “just” JavaScript Myth
React Application Manager
Something that interested me this week
Phew, this past week was super busy for me! I was in 4 different states last week for 2 conferences, a wedding, and visiting some friends.
While doing all this traveling, I thought about how much a flight actually costs an airline. Between employing the staff that cleans and secures the plane, to the flight attendants, to the pilots themselves, as well as the cleaning and fuel costs, plus probably some kind of rent situation with airports... it was fascinating to think about. I found
a Quora answer on the subject that was helpful, but didn't really cite any sources. The next thing I found that quenched my curiosity thirst was
this PDF of a general cost breakdown.
Long story short: airlines make BANK. My last flight had 37 rows in it, with 6 people across each row, so 222 people. Let's say we (on average) all paid $250 per ticket, that's $55,500. For a flight that costs less than $4000 per hour for about a 3 or 4 hour flight, that is a pretty sweet margin. You learn something new everyday!
Interview question of the week
A bunch of you did the question for reversing a queue this week! Emma emailed me her solution:
static public LinkedList<Integer> reverseQueue(LinkedList<Integer> forward) {
LinkedList<Integer> backward = new LinkedList<Integer>();
return reverseQueueRecursive(forward, backward);
}
// recursive helper method
static public LinkedList<Integer> reverseQueueRecursive(LinkedList<Integer> forward, LinkedList<Integer> backward) {
if (forward.peekLast() == null) {
return backward;
} else {
backward.add(forward.pollLast());
return reverseQueueRecursive(forward, backward);
}
}
Meanwhile, these lovely folks tweeted theirs!
This week’s problem:
Given an unsorted integer array arr and an integer n, return a pair of numbers (from arr) whose product is closest to n.
Example:
closestProduct([5,3,8,2,7], 42);
> [5, 8]
Cool things from around the internet
HHKB with pastel caps
Want to Remember the Notes You Take? Here’s Why You Need to Write Them By Hand
How a Uranium Hunter Sniffs Out Nuclear Weapons
The Chorus: by Anthony Bourdain
Joke
A backpacker walks into a bar. The bartender says, “Welcome! What are you drinking?”
The backpacker, weary from her journey, says, “Your finest pale ale, please.” The bartender tells her, “Sure thing.”
As he pours her a pint, he makes her an offer.
“Since you’re new here, I’ll offer you a gift I offer all of my first time customers. You may choose either this first pint of ale is free or instead you may pay for the beer and I will give you a piece of valuable advice.” The backpacker pondered before deciding.
“I’m intrigued by your offer. I will pay for my ale, now please share the valuable advice.” The bartender grinned, counting the cash she had given him, looked her in the eye and said, “You should’ve taken the free beer.”
Thanks for reading again, friends. Have a great week. Be safe, make good choices, and talk to your loved ones.
cassidoo