Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save virtcoder/be222d442d1e342db728e1741d4a0dce to your computer and use it in GitHub Desktop.
Save virtcoder/be222d442d1e342db728e1741d4a0dce to your computer and use it in GitHub Desktop.
Whiteboarding
* @param {string} s
* @return {number}
*/
var numDecodings = function(s) {
//create counter var
//create traversal func- takes in start and end index
//edge case
// if we are at end of string
// increase counter
//recursion
//check if first index is valid
//
--------------------------
//First Pass/ Idea
//define helper function (isNumValid())
//if length is 1 and value is not 0
//return true
//if length is 2 and value does not start with 0 and val < 26
//return true
//take the first char/num in s and put it our helper func
//if num is valid
//call numDecodings again on the rest of string, not on what we just checked
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment