FastPrepCount Perfect Breaks
Problems/Count Perfect Breaks

Count Perfect Breaks

Atlassian logoAtlassian● HardFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time online assessment. The report gives all the rules for splitting and one example worked out in full. We chose the numeric limits. Our version is about 98% the same as the reported question.

For a non-negative integer array arr of length n, arrays b and c form a perfect break when both have length n, every value is non-negative, b is non-decreasing, c is non-increasing, and b[i] + c[i] = arr[i] for every index.

Return the number of perfect breaks modulo 1,000,000,007.

Function

countPerfectBreaks(arr: int[]) → int

Examples

Example 1

arr = [2,3,2]return = 4

The four valid non-decreasing arrays b are [0,1,1], [0,1,2], [0,2,2], and [1,2,2]; each determines c = arr - b.

Constraints

  • 1 <= arr.length <= 200000
  • 0 <= arr[i] <= 1000000

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

  • Optimize Discount Selection Under a Point BudgetPalantir · OAPalantir interview questions
  • Pressure-Isolation Shutdown OrderIntuit · OAIntuit interview questions
  • Count Permutations Without Three Equal Parities in a RowGoogle · OAGoogle interview questions
  • Count Good SubsequencesFlexport · OAFlexport interview questions
  • Sum of Compressed Number for All SubarraysWells Fargo · OAWells Fargo interview questions
  • Count Strictly Increasing Subsequences of Length 3IBM · OAIBM interview questions
  • Winning Draws for a Mahjong HandZip · PHONE SCREENZip interview questions
  • Coin Change IIApple · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
  • Split Array to Minimize the Largest SumInfosys · OAInfosys interview questions
  • Largest Consistent Visiting GroupAuxoAI · OA

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 int countPerfectBreaks(int[] arr) {
      // Write your code here.
    }

}
Checking account…