A trie implementation in python.
Analysis of a leetcode question involving topological sort.
I decided to do an easy one today, but it still had a few good tricks! Here is the prompt:
Compare two version numbers version1 and version2.
If version1 > version2 return 1; if version1 < version2 return -1;otherwise return 0.
You may assume that the version strings are non-empty and contain only digits and the . character.
The . character does not represent a decimal point and is used to separate number sequences.
For instance, 2.5 is not "two and a half" or "half way to version three", it is the fifth second-level revision of the second first-level revision.
Input: version1 = "0.1", version2 = "1.1" Output: -1
Input: version1 = "1.0.1", version2 = "1" Output: 1
Input: version1 = "184.108.40.206", version2 = "7.5.3" Output: -1
Ok, seems straightforward enough. Let’s think this through. How are we comparing version numbers? Well, the left-most number has the most priority, one to the right the second most priority, etc… we should just …read more
In preparation for fulltime interviews in the coming months I’ve been doing a lot of leetcode questions. I have many feelings on whether or not this is the best way to determine someone’s coding abilities, but that’s for a different post. I wanted to share my struggles with one particular question: word ladder ii. I’m …read more
How to customize field errors with Rails 5 and Bootstrap 4
I arrived in Lima about one week ago. I was literally shocked by the culture immediately when I got off of the airplane. 7 hours on a plane and I’m surrounded by a city slightly bigger than NYC in population, that speaks almost exclusively another language, which I know not-that-much about. It was chaos, the whole …read more
It’s been quite a while since I’ve written about a book I read this year, it’s time to catch up! First in my queue is How Proust Can Change Your Life by Alain De Botton. Earlier this year I was really on a Botton-kick and bought this book right after reading On Love since I enjoyed that …read more
This one was pretty fun! To be honest, I found it a little tricky at first but once I got the hang of it the math was pretty easy. The key is understanding that the velocity of each square is how much they each move on the line y = x every interval. NOT how much …read more
How to fix Atom Error: Const’ is available in ES6 (use ‘esversion: 6’).
Andy Puddicombe is the voice of Headspace, a guided meditation app which has gotten some attention recently. I’ve been using Headpace for over a year now and really love it. As I was meditating this morning I had a question regarding the meditation and wanted to reach out to Andy. Hopefully I’ll get a response! The question …read more