This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a popular question asked on interviews. The optimum solution is achieved by using recursion. Because it's kind of building a binary tree with possible moves. | |
// **DECODE WAYS** | |
// PROBLEM DESCRIPTION: | |
// A message containing letters from A-Z is being encoded to numbers using the following mapping: | |
// 'A' -> 1 | |
// 'B' -> 2 | |
// ... | |
// 'Z' -> 26 | |
// Given a non-empty string containing only digits, determine the total number of ways to decode it. |