---
# System prepended metadata

title: Session 2

---

# Session 2

Given an array of codes and their decodes, create a function to decode an encoded message

Example Input:

```python
codes = ['a\t100100', 'b\t100101', 'c\t110001', 'd\t100000', '[newline]\t111111', 'p\t111110', 'q\t000001']
encoded = "111110000001100100111111100101110001111110"
```

Example output:
```
pqa
bcp
```

Make sure to practice the **[UMPIRE method](https://hackmd.io/@zXKevDKYS9a3T9goj4clQA/S1CaDzIiV?type=view)**!

:::spoiler

1. **Understand**

Ask clarifying questions and use examples to understand what the interviewer wants out of this problem
Choose a “happy path” test input, different than the one provided, and a few edge case inputs. Verify that you and the interviewer are aligned on the expected inputs and outputs.

2. **Match**

See if this problem matches a problem category (e.g. Strings/Arrays) and strategies or patterns within the category

3. **Plan**

Sketch visualizations and write pseudocode
Walk through a high level implementation with an existing diagram

4. **Implement**

Implement the solution (make sure to know what level of detail the interviewer wants)

5. **Review**

Re-check that your algorithm solves the problem by running through important examples
Go through it as if you are debugging it, assuming there is a bug

6. **Evaluate**

Finish by giving space and run-time complexity
Discuss any pros and cons of the solution
:::


### Lets get to it!

Fork the repl on your own repl and create a multiplayer session with your teammate :)

**Python**
<iframe height="600px" width="100%" src="https://repl.it/@membriux/codepath-practice-session2-python?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>

<br>

**Java**
<iframe height="600px" width="100%" src="https://repl.it/@membriux/codepath-practice-session2-java?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
