## Algorithm Explained: Determine if two strings have a substring in common

Problem statement: Given two strings, determine if they have a substring in common. Example: Do “hello world” and “world” have a substring in common? Yes, they both have the substring “world”. Approach What are all the substrings of string? The string “word” is four characters long. It contains 10 substrings between length 1 and 4. … Read more

## C# – Hex string to byte array

This article shows code for converting a hex string to a byte array, unit tests, and a speed comparison. First, this diagram shows the algorithm for converting a hex string to a byte array. To convert a hex string to a byte array, you need to loop through the hex string and convert two characters … Read more

## Solving whiteboard problems to prepare for coding interviews

Companies like to ask you to solve whiteboard problems during coding interviews. If it’s an in-person interview, they’ll ask you to solve the problem on a physical whiteboard. If it’s a remote interview, they’ll either have you solve the problem on a website like HackerRank, or they’ll ask you the question in a “digital whiteboard” … Read more

## Algorithm Explained: Counting set bits in a 32-bit signed integer

Problem statement: Given a 32-bit signed integer, how many set bits are there? Ex: The number 15 has four bits set. In this article I’ll explain how I’d approach this problem. Approach How do I know if a bit is set? A bit can either be 0 or 1. A bit is set if its … Read more