FastPrepGenerate Parentheses
Problems/Generate Parentheses

Generate Parentheses

Atlassian logoAtlassian● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time online assessment. The report links to the exact Generate Parentheses exercise but does not copy its full statement. Our version follows that linked exercise. The function you write returns the result.

Given n pairs of parentheses, return every well-formed sequence containing exactly those pairs.

Return the sequences in lexicographic order.

Function

generateParenthesis(n: int) → List<String>

Examples

Example 1

n = 3return = ["((()))","(()())","(())()","()(())","()()()"]

These are all five balanced sequences using three pairs, ordered lexicographically.

Constraints

  • 1 <= n <= 8

More Atlassian Online Assessment questions

  • Planning ProductionOA · Seen Feb 2025
  • K-Means ClusteringOA · Seen Feb 2025
  • Minimum Sorted Erasure OperationsOA · Seen Jun 2024
  • Count Analogous ArraysOA · Seen Mar 2024
  • Get Maximum ScoreOA · Seen Mar 2024
  • Better Compression 🦀OA · Seen Mar 2024
  • Romanizer 🐡OA · Seen Mar 2024
  • Flower Bouquets 💐OA · Seen Mar 2024
  • Binary Search Tree IteratorOA · Seen Nov 2023
  • Binary Tree Level Order TraversalOA · Seen Nov 2023

Similar questions at other companies

  • Next Number with Disjoint DigitsElevenLabs · OAElevenLabs interview questions
  • String Permutations in Custom Character OrderWex · OA · PHONE SCREEN
  • Generate ParenthesesThe Walt Disney Company · OAThe Walt Disney Company interview questions
  • Reverse and AppendUber · OAUber interview questions
  • All Palindrome PartitionsExpedia · OAExpedia interview questions
  • Equal-Sum Digit PartitionsAlchemy · OA
  • Maximum Number after K SwapsIntuit · OAIntuit interview questions
  • Generate Balanced ParenthesesInMobi · OAInMobi interview questions
  • Work ScheduleSnowflake · OASnowflake interview questions
  • Work Schedules (for MTS2)Nutanix · OANutanix interview questions

Atlassian interview experiences

  • Atlassian MLE Phone Screen: Model Deployment Design: 1 Experience
  • Atlassian Coding Screens and Karat: 3 Experiences (Part 2 of 2)
  • Atlassian Full Stack Interviews: 11 Experiences (Part 1 of 2)
All Atlassian interview questionsSee Atlassian hiring insights
Saved
class Solution {
    public List<String> generateParenthesis(int n) {
      // Write your code here.
    }

}
Checking account…