Try all sequences of insert, delete, replace operations until word1 becomes word2.
The search tree branches three ways at each step, leading to exponential complexity.
Can you define the problem recursively and reuse overlapping subproblems?
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
The trap
Try all sequences of insert, delete, replace operations until word1 becomes word2.
The search tree branches three ways at each step, leading to exponential complexity.
Can you define the problem recursively and reuse overlapping subproblems?