FastPrepMerging Palindromes
Problems/Merging Palindromes

Merging Palindromes

Atlassian logoAtlassian● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time online assessment. The text, the screenshots, and the shared code all agree on the rule for choosing the pairs and the center. Our version is about 98% the same as the reported question.

From the letters of first, choose a multiset that can be rearranged into a palindrome. Do the same independently for second. Combine the two chosen multisets and rearrange them into one palindrome.

Return the longest palindrome obtainable this way. If several have maximum length, return the lexicographically smallest.

Function

mergingPalindromes(first: String, second: String) → String

Examples

Example 1

first = "aabbc"second = "ddefefq"return = "abdefcfedba"

Use all available pairs and the smallest usable center. The result has maximum length and is alphabetically smallest among those results.

Constraints

  • 1 <= first.length, second.length <= 200000
  • Both strings contain lowercase English letters only.

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

  • Longest Non-Decreasing Substring After Pair SwapsVisa · OAVisa interview questions
  • Valid Binary PrefixGoldman Sachs · OAGoldman Sachs interview questions
  • Merging PalindromesZscaler · PHONE SCREENZscaler interview questions
  • Maximum String OperationsMicrosoft · OAMicrosoft interview questions
  • Minimum No-Repeat Segments After One Character RemovalSalesforce · OASalesforce interview questions
  • Minimum Deletion Cost for Distinct Adjacent CharactersHSBC · OAHSBC interview questions
  • Minimum Binary Swaps to a PalindromeAT&T · OAAT&T interview questions
  • Robot Assembly Line ConflictsGoogle · OAGoogle interview questions
  • Count One-Swap Number PairsCapital One · OACapital One interview questions
  • Substring RemovalJP Morgan Chase · OAJP Morgan Chase 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 String mergingPalindromes(String first, String second) {
      // Write your code here.
    }

}
Checking account…