How to Solve a Difficult Problem

Good problems teach you how to think.

How to Solve a Difficult Problem

When you face a difficult problem, you have to take a systematic approach that consists of essential steps in problem-solving. I propose the following procedure to crack a difficult problem:

  1. Determine how to solve the problem (e.g. dynamic programming) and come up with an appropriate data structure (e.g. 2D array) on which your algorithm will run.
  2. Solve a small example using the data structure by hand.
  3. Then make a flowchart based on how you solved the problem in the previous step.
  4. Offset corner cases.
How I solved a difficult problem.


Common Child | HackerRank
Given two strings a and b of equal length, what’s the longest string (s) that can be constructed such that s is a child to both a and b?