Technical interviews are a pain. But here’s a 2-step plan to ace them:
- Pick Java as your programming language du jour.
- Use LinkedHashMaps.
The HashMap is great and usually the go-to data structure during an interview. But an interviewer who’s a jerk will always try to unnecessarily put down the HashMap. Here’s how that conversation might go:
Interviewer: HashMap, eh? But what if you want to keep the map to a certain size by removing the oldest entry when you hit the size limit?
You: Did you know about the LinkedHashMap method removeEldestEntry?
Interviewer: What if you want to have the performance of a map but you want to know the order things were put in?
You: Did you know keys can be iterated over in insertion-order? And before you ask - yes, you can iterate over the items in the order they were accessed.
Interview: Wow! You really know a lot! But can you reverse a linked list?
You: Yes I may know how to do something I would never actually do if you hired me, but did you know that internally the LinkedHashMap implementation maintains a doubly-linked list?
Interviewer: Wow! You’re great! When can you start?
You: I’ve already converted every pleb data structure in your codebase into a LinkedHashMap. *walk out*
Boom! You’re hired!
Some technical interviews may have you believe that a good engineer is someone who can flatten binary trees efficiently, regurgitate performance of red-black trees, or solve some tricky puzzle. That could be the case in an algorithms course, but that’s not the case in the real world. What separates bad from good when it comes to engineers is one’s search engine proficiency.
The situation: you’re faced with a problem (a bug) or a very serious problem (someone asking you to implement some snazzy new feature). You break the problem down into small units of work and start tackling them one by one. And before you know it, you run into an issue. What happens now?
Good engineers run to google.com and start looking for an answer. It is very unlikely that you are the first person running into your particular problem. So leverage that fact! Good Google-fu will usually get you to an answer or at least orient you in the right direction. The worst outcome is finding absolutely nothing or — even worse — a StackOverflow post from many years ago with no answers. In that unfortunate case, you’re going to have to actually be an engineer and do some sleuthing yourself.
Good engineers get from not knowing the answer to delivering the correct answer fast!
Say what you will about Square Enix, but lately I think they’re dishing outs lots of love.
- The release date for Final Fantasy XV was announced and it’s only 6 months away: September 30th! Can’t wait? No worries! Square Enix also released the Platinum Demo for you to check out today.
- Not only are we getting a game, Final Fantasy XV will also have a short animated series called Brotherhood to introduce the FFXV story. And there will also be a full-length feature CGI film called Kingsglaive. You can watch the first episode of Brotherhood and the Kingsglaive trailer on YouTube.
- Bravely Second: End Layer hits North American shores in two weeks. If you long for a Final Fantasy that is more traditional, stop complaining about the modern Final Fantasy games and pick up this awesome old-school JRPG. If you somehow haven’t played the original Bravely Default yet, do it now!
- The beloved Dragon Quest VII and Dragon Quest VIII will be re-released on the 3DS in North America in 2016. Originally released on the Playstation and Playstation 2 respectively, these re-releases will bring the number of Dragon Quest games you can play on a North American 3DS to six (i.e. IV through IX)!
- The North American release date for Star Ocean 5 was also announced this week: June 28th! Entries in the series since the beloved Star Ocean 2 have received mixed reviews, but with a solid 34/40 from Famitsu, Star Ocean 5 is shaping up to be a solid JRPG entry in 2016. Not appealing enough? The Day One Edition will allow you swap out the battle music with the Valkyrie Profile battle themes!
This is great stuff! The only thing missing here is a Valkyrie Profile 3 announcement!
Codenames is an incredibly fun, deep, and addicting tabletop game. The game revolves around a 5 x 5 grid of words. Two teams race to pick out the eight (or nine if you go first) words that belong to your team. Two spymasters give their teams one-word clues that will hopefully guide their teammates to their respective words on a 5 x 5 board. Clues that let teams pick more words correctly are better. The first team to get all their words win!
It’s fun. It’s funny. It’s hard. But we can make this game easy, not fun, and more like a math exercise. How? With binary! We can do this because:
- While a particular word can be blue (one team), red (the other team), black (instant loss if selected), or beige (turn ends immediately) we only care about whether it’s a word belonging to our team or not. Ours or not ours. Binary.
- The numbers from zero to a hundred can be expressed as SINGLE words. Yes, the numbers 21 through 99 are hyphenated! This grammar technicality is powerful!
- Given we’re restricted to one word clues that will be numbers ranging from 0 to 100, we can usually express 6 bits of information and sometimes 7. For reference, 111111 (6 bits) = 63, 1111111 (7 bits) = 127, 1000000 (7 bits) = 64. In some cases were we have a lot of 0s at the end, we will express less than 6 bits of information (e.g. 01 is equivalent to 000000001).
What does this all mean? With 5 x 5 grid of words the spymaster has 25 bits of information they need to get across to their team. Using only one word you can transmit about 6 bits of information. So you’ll about need 5 turns to share 25 bits because 6 + 6 + 6 + 6 + 6 > 25. But depending on how the words you need to pick are placed (i.e. the last few spaces on the board do not belong to your team so you’ll win before you need to share this information), and if you can squeeze in a 7-bit number, you’ll on average only need 4 turns to win!
Here’s an example of what this would look like for a particular configuration. In this example, we’ll play the role of the red team. The red team goes first so we’ll need to pick out 9 words.
- 1st turn say “70” - 1000110, 7 bits, yellow text
- 2nd turn say “20” - 10100, 5 bits, green text
- 3rd turn say “64” - 1000000, 7 bits, pink text
- 4th turn say “44” - 101100, 6 bits, white text
Note that the green text number (i.e. 10100) highlights the case mentioned above about expressing a lower than average amount of bits when we have a lot of 0s.
My friends and I have played a lot but we have not gotten to the point where we can win in 4 turns. That said, are we going to use this system? Probably not… since it ruins in the fun and, more importantly, breaks the rule that the clue must be “about the meaning of the word.” That said, it was a fun thought exercise.
I do instructor scheduling for the San Francisco Kendo Dojo. Google Calendar and creating events that repeat monthly solves most of the scheduling puzzle. But I was sometimes getting questions about who was teaching and when. I decided weekly reminders directly to instructors' email inboxes with the week’s schedule was the way to keep everyone up-to-date. In keeping with 2016’s automation goal, I decided to automate these weekly reminders.
kendo-emailer is a Java-based project that uses the Google Calendar and Gmail API. It pulls events from the kendo instructor calendar, creates a nice email for any events within the next 2 weeks, and sends it to all the instructors. For anyone teaching in the coming week, their last name is put in the subject. The idea here is that even if someone does not open the email, they will hopefully see their name in the subject line!
I use CronniX to schedule weekly emails by running this project on my home server. To ensure I don’t email instructors anything weird I have the project email only me (preview mode) on Friday afternoon. If everything looks good, I don’t need to fix anything for the email sent to everyone (production mode) on Saturday. This preview/production system is a cheap and easy way to let me “deploy” code that impacts people.
I’m happy to report that the reminder emails have been very well-received! I generalized kendo-emailer to share it without compromising personal information (e.g. instructor names and emails are pulled from a CSV file that is gitignored). I hope it’s helpful for anyone looking to do some automation with Google Calendar and Gmail.