# How to Use Recursion to Flatten a JavaScript Object

A walkthrough of a recursive algorithm problem.

## The Problem:

`Given an object oldObj, write a function flattenObject that returns a flattened version of it. If a certain key is empty, it should be excluded from the output. When you concatenate keys, make sure to add the dot character between them. For instance when flattening KeyB, c and d the result key would be KeyB.c and KeyB.d. Example: const oldObject = {    "KeyA": 1,     "KeyB":{        "c": 2,         "d": 3,         "e":{            "f": 7,             "" : 2         }      }}Output: {    "KeyA": 1,     "KeyB.c": 2,     "KeyB.d": 3,     "KeyB.e.f": 7,     "KeyB.e": 2}`

The first…

# How to Use Recursion to Solve a PlusMinus Problem

Today we talk about how to use recursion to solve a specific algorithm problem.

I recently did a coding challenge as part of a job interview and they asked an algorithm problem I hadn’t come across before. I thought this one was particularly interesting and at the time I had no clue how to solve it, so today let’s break it down together. Here’s the problem:

`Have the function PlusMinus(num) read the num parameter being passed which will be a combination of 1 or more single digits, and determine if it's possible to separate the digits with either a plus…`

# How to Use the Sliding Window Approach to Find the Smallest Substring Containing Elements From an Array

Today I’m going to explain how to use the sliding window approach to solve a problem.

Like many others out there I have been doing all of the algorithm problems to prepare for technical interviews. One thing I have found that has helped me improve is learning some of the patterns that can be used to solve these problems. There is a great course on educative.io called Grokking the Coding Interview: Patterns for Coding Questions that has been really helpful in improving my skills. …

# How to Merge Intervals, Step-by-Step

Today we are tackling another common algorithm problem: how to merge intervals.

Recently in a practice technical interview I was answering a variation of the merge intervals problem and something awful happened. I froze up. It was like I couldn’t think logically or explain my process while trying to code in front of this stranger. This was unpleasant and I would prefer not to experience it again. So, what is my plan? I’m going to explain a basic version of this problem to you today. Why? Because explaining a problem to someone else helps me walk through my process and…

# How to Find an Element in a Sorted, Rotated Array in O(log n)Time

Hey everybody, I’ve recently started my job search and like for any other junior dev job hopeful that means lots and lots of algorithm practice.

My process when I first started working on these kinds of problems went like this: look at problem, get stressed out about problem, frantically google solution to problem, get stressed out about understanding solution to problem, go into downward spiral about future of my career. After operating like that for a while I realized it was both unhelpful and unsustainable and that it was necessary to start confronting these problems head on and find a…

## amkemp

Ann-Marie Kemp is a full stack software engineer living in New York City. She is currently studying algorithms and job hunting for a junior developer position.

Get the Medium app