PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates string parsing and encoding/decoding skills, specifically mapping numeric tokens and handling delimiter characters within the Coding & Algorithms domain and focusing on practical implementation-level string manipulation.

  • hard
  • Instacart
  • Coding & Algorithms
  • Software Engineer

Decode a password string into letters

Company: Instacart

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

A password is encoded as a string `s` using the following rules: - Numbers `"1"` to `"9"` map to letters `a` to `i`. - Numbers `"10#"` to `"26#"` (two digits followed by `#`) map to letters `j` to `z`. For example: - `"1" -> "a"` - `"9" -> "i"` - `"10#" -> "j"` - `"26#" -> "z"` **Task**: Given the encoded string `s`, return the decoded lowercase string. **Input/Output** - Input: a single string `s` consisting of digits and `#`. - Output: the decoded string. **Constraints** - `1 <= len(s) <= 1000` - The input is guaranteed to be a valid encoding. **Examples** - `s = "10#11#12"` → `"jkab"` - `s = "1326#"` → `"acz"` (Implementation note: you may need to manually parse the input string and handle `#` correctly.)

Quick Answer: This question evaluates string parsing and encoding/decoding skills, specifically mapping numeric tokens and handling delimiter characters within the Coding & Algorithms domain and focusing on practical implementation-level string manipulation.

A password is encoded as a string s using the following rules: numbers "1" to "9" map to letters "a" to "i", and numbers "10#" to "26#" map to letters "j" to "z". Given a valid encoded string s, return the decoded lowercase string.

Constraints

  • 1 <= len(s) <= 1000
  • s contains only digits and '#'
  • The input is guaranteed to be a valid encoding
  • Every '#' appears as part of a valid token from "10#" to "26#"

Examples

Input: ("10#11#12",)

Expected Output: "jkab"

Explanation: "10#" maps to 'j', "11#" maps to 'k', "1" maps to 'a', and "2" maps to 'b'.

Input: ("1326#",)

Expected Output: "acz"

Explanation: "1" maps to 'a', "3" maps to 'c', and "26#" maps to 'z'.

Input: ("1",)

Expected Output: "a"

Explanation: Single-character edge case: "1" maps directly to 'a'.

Input: ("26#",)

Expected Output: "z"

Explanation: Boundary two-digit code: "26#" maps to 'z'.

Input: ("123456789",)

Expected Output: "abcdefghi"

Explanation: There are no '#' characters, so each digit from 1 to 9 maps individually.

Input: ("20#1",)

Expected Output: "ta"

Explanation: "20#" maps to 't', followed by "1" which maps to 'a'.

Hints

  1. When parsing from left to right, check whether the current position starts a two-digit code followed by '#'.
  2. The numeric value 1 maps to 'a', 2 maps to 'b', and so on; converting with character arithmetic can help.
Last updated: Jun 25, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Fix the Broken Search Filter in a Book Catalog API - Instacart (medium)
  • Find Largest Adjacent Stock Price Change - Instacart (medium)
  • Implement an In-Memory File Storage System - Instacart (medium)
  • Evaluate an arithmetic expression - Instacart (medium)
  • Decode an encoded string - Instacart (medium)