Code Exercises
  • Interview Planner
  • Interview Guide
  • Practice Now
  • Blog
  • About

Longest Harmonious Subsequence - Hash Map vs Sorting Solutions

February 27, 2021

Every time you bump into a coding exercise with an obvious brute force solution, the first question you should ask is, “Can I use a hash map to optimise the solution?”. If so, that solution typically results in linear time complexity. If the answer is no, the second question should be, “Can I use sorting to optimise the solution?”. In this case, the limiting factor tends to be the sorting algorithm; the best algorithms such as Quick Sort or Merge Sort result in a O(NlogN) time complexity.

Continue reading

Trim a Binary Search Tree - Recursive vs Iterative Solutions

February 24, 2021

For most binary tree problems, recursive solutions are the most elegant and compact. LeetCode exercise Trim a Binary Search Tree is not an exception.

Continue reading

Learn Kotlin with FizzBuzz programming exercise

June 26, 2020

Traditional high-level programming languages such as Java, C#, and C++ were designed to support imperative/procedural programming. Modern programming languages such as Kotlin make it easier to code more functional and readable solutions. In this post, I start with an imperative, non-Kotlin-esque solution for the FizzBuzz code exercise; I then refine that solution in a series of steps, explaining the following Kotlin features along the way:

Continue reading

Covid-19 Cinema Seat Allocation Coding Problem

June 3, 2020

I often get asked: how do I practice for interview code exercises, and do something useful at the same time? Here is an idea.

Continue reading

The Best Code Kata Ever

May 23, 2020

Code katas are small coding exercises to sharpen your programming skills. In this post, I’ll show you my favourite code kata. The core idea is to resolve a relatively simple programming problem, following an exaggerated version of coding best practices.

Continue reading

Berlin Clock Code Kata in Java

March 15, 2018

Berlin Clock is a classic code exercise. The main challenge is to understand how time is represented, that may be confusing at first. Once you get your head around that, the algorithm itself is straightforward, so you should be able to code it fairly quickly.

Continue reading

Hacker Rank Review for Programming Job Candidates

February 23, 2018

Next on the list of reviews for programming exercise websites is Hacker Rank. This follows reviews for Coding Bat and Project Euler.

Continue reading

Coding Bat Review for Programming Job Candidates

February 22, 2018

This is the second part of a series of posts reviewing code exercise website to practice for a coding interview. I have started the series looking at Project Euler, this post will focus on Coding Bat.

Continue reading

Announcing our YouTube channel

February 10, 2018

I have started a new YouTube channel here. I will regularly upload videos about software engineering topics and programming exercises in particular. The first video walks you through the solution of the most famous code exercise - the FizzBuzz - in just over two minutes.

Continue reading

Project Euler Review for Programming Job Candidates

February 9, 2018

I have found a few good blog posts with reviews of code exercise websites. However, most of these posts are targeted at either competitive programmers or complete beginners. I am starting a series of posts reviewing the most popular programming exercise sites from the perspective of a programming job candidate.

Continue reading
Next