FastPrepLongest Happy String with a Stable Tie Rule
Problems/Longest Happy String with a Stable Tie Rule

Longest Happy String with a Stable Tie Rule

Adobe logoAdobe● HardFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The original author names Longest Happy String by its problem number. The named task allows any longest valid result. Here, we require the lexicographically largest longest result, so all languages share one expected answer.

Our version is about 95% the same as the reported question.

Build a string using at most a copies of a, b copies of b, and c copies of c. It must contain no aaa, bbb or ccc substring.

Return a string of maximum possible length. For this exercise, if several strings have that length, return the lexicographically largest one, using a < b < c. You may leave letters unused when needed.

Function

longestHappyString(a: int, b: int, c: int) → String

Examples

Example 1

a = 1b = 1c = 7return = "ccbccacc"

Two non-c letters can separate at most three groups of two c letters, so only six c letters can be used. The maximum length is eight. The lexicographically largest such string is ccbccacc.

Example 2

a = 7b = 1c = 0return = "aabaa"

The single b separates at most two groups of two a letters, so the maximum length is five. The only length-five arrangement is aabaa.

Constraints

  • 0 <= a <= 100, 0 <= b <= 100 and 0 <= c <= 100.
  • a + b + c is positive.

Source note: Original OA task images and any included source example. The practice contract follows the rules stated in the problem and source note.

More Adobe Online Assessment questions

  • Base Unit ConversionsOA · Seen Nov 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Top-Funded Villages and ProjectsOA · Seen Aug 2026
  • Count Parent Nodes With a Target SumOA · Seen Aug 2026
  • Largest Binary Number by ConcatenationOA · Seen Aug 2026
  • Count Events by CategoryOA · Seen Aug 2026
  • Graph M-ColoringOA · Seen Aug 2026
  • Hall of Shifting TilesOA · Seen Aug 2026
  • K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
  • Maze ReachabilityOA · Seen Aug 2026

Similar questions at other companies

  • Binary CircuitAkuna Capital · OAAkuna Capital interview questions
  • Minimize Expression with ParenthesesPinterest · OAPinterest interview questions
  • Minimize Difference Between Two NumbersMicrosoft · OAMicrosoft interview questions
  • Return Exact Cash Register ChangeBank of America · OABank of America interview questions
  • Digit Changes for a Multiple of 9Nutanix · OANutanix interview questions
  • Minimum Digit Swaps for the Smallest DifferenceLSEG · OALSEG interview questions
  • Reorderable Task Scheduler With CooldownWaymo · PHONE SCREENWaymo interview questions
  • Smallest Number With a Given Digit SumAmazon · ONSITE INTERVIEW
  • Smallest and Largest Numbers with a Digit ProductJane Street · PHONE SCREENJane Street interview questions
  • IP Range to CIDR BlocksAirbnb · PHONE SCREENAirbnb interview questions

Adobe interview experiences

  • Adobe New Grad OA: Unit Conversion and Code Review: 1 Experience
  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public String longestHappyString(int a, int b, int c) {
        // Write your solution here.
    }

}
Checking account…