← Back to all problems
Medium

Decode Ways

Updated Feb 24, 2026

Problem

Return number of ways to decode the string.

Constraints

1 <= s.length <= 100

Examples

Example 1

Input: {"s": "12"}
Output: 2

Function Signature

def numDecodings(self, s: str) -> int

How to Submit

Implement a Solution class with a numDecodings method.

Your method will be called with the input parameters and should return the answer.