Video courses for company/skill based Preparation
Purchase mock tests for company/skill building
Java Code to Count Possible Decoding Of A Given Digit Sequence
Count Possible Decoding Of A Given Digit Sequence
This type of questions(or similar questions) are most probably asked in Interviews. Java Code to Count Possible Decoding of a Given Digit Sequence returns the number of decodings possible for a string. Check below example for better understanding
- String=”123″ , possible decodings are
- Step 1: Start
- Step 2: input given
- Step 3: Set count = 0
- Step 4: If the last number is not a zero, then return for the next remaining (n-1) numbers and add the results then to the total count.
- Step 5: If the last two digits form a valid variable (or smaller than 27), return for the remaining (n-2) numbers and add the outcome to the total calculation.
- Step 6: Stop