Menu

String Compression and Concatenation Performance

Here is a whiteboarding problem that may come up in interviews. You are given a string. Implement a function to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2blc5a3. If the "compressed" string would not become smaller than the original string,…

Tree Traversal

BFS vs. DFS When you need to search or traverse a graph or tree-like structure, there are two common algorithms: breadth-first search and depth-first search. Which algorithm to use really depends on the structure of the tree and the location of the items you need to find. Here are some…