Jach's personal blog

(Largely containing a mind-dump to myselves: past, present, and future)
Current favorite quote: "Supposedly smart people are weirdly ignorant of Bayes' Rule." William B Vogt, 2010

Jump Game As Interview Problem, Domain Solutions

Over on LeetCode, there's a problem known as the Jump Game.

Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.

Example 1:
Input: [2,3,1,1,4]
Output: true
Explanation: Jump 1 step from index 0 to 1, then 3 steps to the last index.

See Full Post and Comments

Intangible costs matter in compensation packages

If you commute to work by car, what would you rather have: free parking or a $4k increase in annual salary?

Note that if you pay $15/day for parking, and take no days off, that comes out to $3900. So the raise is strictly more than the cost, even.

I would pick parking. That's because even though raise > parking_cost, the actual comparison is raise vs. parking_cost + intangible_costs.

See Full Post and Comments

The mythical C and C++ replacements

I watched this recent talk by Bryan Cantrill, and thinking about it got me to write up some older periodic thoughts. It's probably worth reanalyzing this topic every few years (especially if I look deeper into any of the languages listed below) but consider this the first one.

Unlike Bryan I'm more interested in the theoretical replacement language for game programming rather than systems programming. The big "enemy" here is C++, but C is still very common especially at the library and middleware layers, so I think we're in alignment in generally aiming at C and C++ together.

See Full Post and Comments

Ramblings on data structure literals

I've been stewing a bit about Clojure's pretty data structure literals, and finding myself wanting them in other languages. In Common Lisp, maybe enough to use one of the various reader macros for maps. But what is it I really want?

In PHP, you used to have to do array() to make a new array or list. You could have data literals though: array(1, 2) for lists/arrays, array('foo' => 3, 'bar' => 4) for maps. It worked for me. I didn't need literal syntax for sets or anything else.

Later on I learned Python, I prefer the syntax a bit more. (1,2) for a "tuple" (list), [1,2] for an array/list/stack/queue/... very versatile, {'a': 3, 'b': 4} for a map. In JavaScript it (can) be about the same for arrays and maps, though you can leave off the key quotes for maps, but leaving them there (and using double quotes) has the nice side-benefit of being more likely to be valid JSON. It depends on whether your value is something serializable or not of course.

See Full Post and Comments

Japan Trip Part 2: Day log

In the previous post I discussed my initial planning and costs for my two-week trip to Japan that I took last month, this post will just be about my personal notes as I wrote them up on what I did each day as well as some choice pictures. The whole picture gallery can be found here.


I left the morning of the 15th PST from Seattle, had a brief stop in San Francisco, then continued on to Tokyo and arrived on the 16th local time in the afternoon. I made it to the hotel (Hotel Villa Fontaine) around 4:30pm. The main flight was long but not as bad as it could have been, I had just enough leg room and could stand and stretch. The extra leg room upgrade was the correct choice. I managed to avoid using the crapper but it was quite the relief to land and use the first one I found at the airport. ;) I didn't test out the well-known common spray features until I got to the hotel though.

See Full Post and Comments

Japan Trip Part 1: Planning and Costs

Last month I went to Japan for two weeks! Yes, by myself. Leaving on Dec 15th, with the help of an 11 hour flight and timezone changes I arrived on the 16th and stayed until it was time to leave on the 30th. Most of the time was in Tokyo. I had a great time, and kept some notes about what I did most days, so I'm typing them up as well as embedding a few choice pictures. If you want to look at pictures without context, they are here.

For this post I'm going to just write about my travel prep, and leave the details of my time there for my next post. I didn't fully commit myself to going until around November 6th. As such my flight and hotel costs almost certainly could have been lower, but I don't think the whole trip was that expensive. I paid $1358 for the base flight, which went from Seattle -> San Francisco -> Haneda plus about another $170 + $180 + $50 for some leg room extension upgrades on 3 of the 4 flights. At least this seemed to qualify me for 2 free checked bags rather than $50 each as is pretty common. For the international flights, being as tall as I am (about 6'5"), I found this to be a necessity rather than a luxury. There were some additional possible upgrades to what looked like a pod you could fully recline in, something to consider for next time.

So in total, cost of flight was about $1750. With earlier planning, and/or if you're smaller so don't require the extra legroom seats, I'm sure you could find something for half as much. (I actually found some flights around $800 even as late as I was looking but they were multi-stop huge travel time endeavors.)

See Full Post and Comments