Skip to main content
All Questions

Given counts of the letters a, b and c, build the lexicographically smallest string that uses them all and never has the same letter three times in a row.

Unlock detailed company stats for this questionUpgrade
You are given counts A, B and C of the letters a, b and c. Build the lexicographically smallest string that uses exactly A a's, B b's and C c's and never has the same letter three times in a row (for counts 3, 1, 0 the answer is 'aaba').

Community answers

No answers contributed by the community yet.

Related courses

Course

Behavioral Interviews: A Practical Guide for Engineers

Get offers at the level you deserve. Prep for senior+ behavioral interviews at FAANG and Tier-1 companies. Made with staff and principal engineers from Meta, Netflix, Google, and more. Avoid downleveling, elevate past projects, and stop sounding like a robot.

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.