Python Anagrams Challenge

Checking whether two strings are anagrams of each other is a fairly common coding challenge or kata. At a local meetup recently, we looked at an extended version of the challenge: not...

Thinking about Thinking – Recommended Books

Studying algorithms and algorithmic thinking is not only helpful for the the direct application of their concepts and techniques. It is also a way to develop thinking skills per se. A bit...

Power Sets with Python

A power set is the set of all possible subsets of a set. For example, if we have a set containing [A, B, C] the possible subsets are: [[], ['A'], ['B'], ['A',...

PYTHON LOOP INVARIANTS

Writing robust code is always a good idea, but is particularly important for mission critical contexts, such as where safety is an issue. There are several historical examples of where faulty code...

Python Debugging

Sometimes when debugging Python code, it is useful to be able to see the values of the variables at each step in its execution. This can be done with a debugging tool...

The Collatz Conjecture with Python

The Collatz Conjecture is an unsolved problem in Mathematics which lends itself nicely to exploration with Python. The idea is simple: Pick a positive whole number. If it’s odd, multiply it by...

Ransom Note HackerRank Challenge in Python

Image courtesy of Sheila Sund from Salem, United States, CC BY 2.0, via Wikimedia Commons. This Python programming challenge is adapted from a challenge on HackerRank called Ransom Note, which is part...

Introduction to HackerRank for Python Programmers

HackerRank is a site where you can supercharge your Python programming skills, master data structures and algorithms, and stand out to prospective employers by solving challenges alongside programmers from all around the...

Python Programming Challenge – Counting Pairs

Here’s a fun algorithmic challenge for you. Given a list of integers, write a function to find the total number of complete pairs contained in the list. For example: for the input...

Algorithmic Thinking with Python part 3 – Divide and Conquer Strategy

Divide and Conquer is a very powerful technique for solving computational problems. In the last article in this series, we looked at decrease and conquer, which is included by some authors under...