I enjoy doing code exercises in my spare time. Below are some of my solutions that I have written in C, C++ or C# for the exercises provided from three sources: Codility, HackerRank and Gayle Laakmann McDowell’s book “Cracking the Coding Interview“.

### Codility

All solutions scored 100% unless explicitly indicated otherwise. On occasion I will upload poorer scoring solutions as part of my discussion, and describe how the solutions can be optimised.

You can click on the links to my solutions below. They are organised according to Codility lesson.

**Iterations**

(Bonus – Determining whether an integer is a power of two)

**Arrays**

OddOccurencesInArray (Painless, C++)

(Bonus – swapping variables without using a temporary variable)

**Time Complexity**

PermMissingElem (Painless, C++)

**Counting ElementsĀ **

MissingInteger (Painless, C++)

MaxCounters (Respectable, C++)

**SortingĀ **

MaxProductOfThree (Painless, C#)

**Stacks and queues**

### Cracking the code interview

Anagrams (Sorting and searching)

Merge Sorted Arrays (Sorting and searching)

Magic Index (Recursion and Dynamic Programming)

Permutations (Recursion and Dynamic Programming)

Powerset (Recursion and Dynamic Programming)

### LeetCode

Invert Binary Tree

kth largest element in an array medium

### HackerRank

Staircase (Easy)

Between Two Sets (Easy)

### Data Structures and Algorithms Bootcamp (Udemy)

UniqueCharacters (Common interview questions)

IsPermutation (Common interview questions)

OneAway (Common interview questions)