Limited Time Offer:Up to 20% off Hello Interview Premium
Up to 20% off Hello Interview Premium 🎉
Hello Interview
Your Dashboard
System Design
Code
Low Level Design
Behavioral
AI Coding
New
ML System Design
Salary Negotiation
Interview Guides
Blog
System Design
Low Level Design
AI Coding
Behavioral
New
Interview Questions
Success Stories
System Design
Low-Level Design
New
Ask The Community
Discord
Mock Interviews
1:1 Mentorship
Refer a Friend
Pricing
Sign in / Sign up
Search
⌘K
Pricing

Tutor

Implement RLE and Bit Packing Encoder

Implement an encoding algorithm that combines Run Length Encoding (RLE) and Bit Packing (BP). RLE encodes consecutive identical elements as RLE[element, frequency] and is applicable when there are 8 or more repetitions. BP packs exactly 8 non-RLE-eligible elements. RLE is always preferred: if the remaining elements at the end of a sequence are all identical (even if fewer than 8), they are encoded using RLE rather than BP. Examples: - [5,5,5] → RLE[5,3] - [1,1,1,2,3,4,5] → BP[1,1,1,2,3,4,5] - [0,0,0,0,0,0,0,0,0,2,3,4] → RLE[0,9], BP[2,3,4] - [1,1,1,1,1,1,1,1,1,2,2,1] → RLE[1,9], BP[2,2,1] - [0,0,0,0,0,0,0,0,0,2,2,2] → RLE[0,9], RLE[2,3]

Asked at:

Databricks


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Company
​
Level
All Regions
Region

Late December, 2025

Databricks

Senior

Mid December, 2025

Databricks

Senior

There are two encoding types: RLE (Run Length Encoding) and BP (Bit Packing). RLE compresses consecutive repeated elements into the format RLE[element, frequency]. It requires a minimum of 8 repetitions to be applicable. Example: [1,1,1,1,1] → RLE[1,5] BP packs exactly 8 elements that are not eligible for RLE encoding. Default Rule: RLE is always preferred. This means if the remaining elements at the end of a sequence are all identical (even if fewer than 8), they are still encoded using RLE rather than BP. for e.g. [5,5,5] -> RLE[5,3] [1,1,1, 2, 3, 4, 5] -> BP[1,1,1,2,3,4,5] [0,0,0,0,0,0,0,0,0,2,3,4] -> RLE[0,9], BP[2,3,4] [1,1,1,1,1,1,1,1,1,2,2,1] -> RLE[1,9], BP[2,2,1] [0,0,0,0,0,0,0,0,0,2,2,2] -> RLE[0,9], RLE[2,3]

Your account is free and you can post anonymously if you choose.

Hello Interview Premium

Recent interview questions
System Design Guided Practice
Exclusive content
Learn More
Questions
Meta SWE Interview QuestionsAmazon SWE Interview QuestionsGoogle SWE Interview QuestionsOpenAI SWE Interview QuestionsEngineering Manager (EM) Interview Questions
Learn
Learn System DesignLearn DSALearn BehavioralLearn ML System DesignLearn Low Level DesignGuided Practice
Links
FAQPricingGift PremiumHello Interview Premium
Legal
Terms and ConditionsPrivacy PolicySecurity
Contact
About UsProduct Support

7511 Greenwood Ave North Unit #4238 Seattle WA 98103


© 2026 Optick Labs Inc. All rights reserved.