Recently I’ve been working as a Rails developer. I’ve always enjoyed Ruby and I’m grateful for the chance to learn more about this magical language. However, I found myself grappling with a huge code base, and an unfamiliar business domain. Overcoming inertia is often the biggest challenge on a new project. It seems that projects […]

var var

I just learnt today that var in Java is not actually a language keyword. It is actually a reserved magic type name. You can use it as a variable: Why anyone would ever do that, apart from freaking out the code reviewer, I don’t know 🙂

Winforms Nostalgia

Had the chance to spoil myself today 🙂 I needed a tool to migrate and manage quotes from an old json format I had used in a Xamarin application. That provided the perfect excuse to jump back into C# and Winforms. It’s been a while, I must say, I’ve been in Java and Delphi a […]

Android Tip on Delphi Update

Recently I updated from Delphi 11 to Delphi 11.1 and was surprised to find my Android Application couldn’t deploy to the phone anymore. I was getting the following error: [PAClient Error] Error: E7688 Caused by: java.nio.file.NoSuchFileException: c:\program files (x86)\embarcadero\studio\22.0\lib\android\Release\google-play-billing.dex.jar In fact, there were lots of missing files: The solution was to right click on the […]

Leetcode – Integer to Roman

Name: Integer to RomanDifficulty: MediumDescription: Convert an integer to Roman Numerals Example: Input: num = 3 Output: “III Input: num = 58 Output: “LVIII” Input: num = 1994 Output: “MCMXCIV” Just used a simple approach for this one, it’s self-explanatory.

Leetcode – Remove Nth Node From End

Name: Remove Nth Node From End of ListDifficulty: MediumDescription: Remove the nth node from the end of the list, return the list Example: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] Input: head = [1], n = 1 Output: [] Input: head = [1,2], n = 1 Output: [1] Tried to do this in […]

Leetcode – String to Integer (atoi)

Name: String to Integer (atoi)Difficulty: MediumDescription: Convert a string to an integer as per the C++ atoi function Example: Input: s = “42” Output: 42 Input: s = ” -42″ Output: -42 Input: s = “4193 with words” Output: 4193 This is a pretty straight forward solution, I enjoy writing code that parses text.

Leetcode – Reverse Integer

Name: Reverse IntegerDifficulty: MediumDescription: Reverse the given integer, maintain the negative sign Example: Input: x = 123 Output: 321 Input: x = -123 Output: -321 Input: x = 120 Output: 21 This was quite easy, except for overflows. You have to check the number never exceeds an integer. Other than that, it’s a matter of […]

Leetcode – Add Two Numbers

Name: Add Two NumbersDifficulty: MediumDescription: Add two numbers stored in reverse in a linked list Example: Input: l1 = [2,4,3], l2 = [5,6,4] Output: [7,0,8] Explanation: 342 + 465 = 807. Input: l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9] Output: [8,9,9,9,0,0,0,1] Initially when solving this problem, I first made sure the lists were the same size […]

Leetcode – Add Binary

Name: Add BinaryDifficulty: EasyDescription: Given two binary strings a and b, return their sum as a binary string. Example: Input: a = “1010”, b = “1011” Output: “10101” This one stretched the memory. We add bits from right to left, bit by bit, so the first thing we need to do is reverse the string […]