#120
Bencode String Decoder
MEDIUMStringPYTHON
Problem Description
You are building a data parsing utility that needs to decode Bencode-formatted strings. Bencode is a simple encoding format that supports three types: integers encoded as `i<number>e`, strings encoded as `<length>:<content>`, and lists encoded as `l<content>e`. Given an encoded string, decode it and return the original value as a Python object (int, str, or nested list).
Topics
recursionstack
Asked at Companies
apple
Solve This Problem
Sign up to access the interactive code editor, run test cases, view the editorial, and get AI-powered feedback on your solution.
Start Solving →