FastPrepLongest Consistent Activity Streak
Problems/Longest Consistent Activity Streak

Longest Consistent Activity Streak

Atlassian logoAtlassian● HardFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time phone screen. The report has two parts. It defines streaks of neighboring items that step by a fixed amount, and one replacement of any value. The report's own limit rules out empty input. We set the function interface in a common form. Our version is about 98% the same as the reported question.

A consistent streak is a contiguous arithmetic sequence: every adjacent difference is equal. Replace at most one element with any integer and return the greatest possible streak length.

A nonempty array of length one has streak length one; no modification is required.

Function

longestConsistentStreak(activity: int[]) → int

Examples

Example 1

activity = [1,2,10,4,5]return = 5

Replace 10 with 3 to obtain difference one throughout.

Example 2

activity = [1,2,3,8,9,10]return = 4

One replacement can extend either arithmetic run by one.

Constraints

  • 1 <= activity.length <= 200000.
  • Values fit signed 32-bit integers; replacements may be any integer.

Source note: Author-written prompt excerpt retained for source fidelity.

More Atlassian Phone Screen questions

  • Merge Overlapping IntervalsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Tennis Court SchedulingPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Implement a Rate LimiterPHONE SCREEN · Seen Oct 2026
  • Music Player Operation SequencePHONE SCREEN · Seen Sep 2026
  • Underline Shortest Unique SubstringsPHONE SCREEN · Seen Aug 2026
  • Can a Dictionary Word Be Formed from Note Letters?PHONE SCREEN · Seen Feb 2026
  • Word Path Moving Only Right or DownPHONE SCREEN · Seen Feb 2026
  • Ordered Badge Entry and Exit ViolationsPHONE SCREEN · Seen Aug 2025
  • Two Sum with an Ordered Index PairPHONE SCREEN · Seen Aug 2025
  • Can You Finish the Teleporter Board?PHONE SCREEN · Seen Jul 2025

Similar questions at other companies

  • Split Array to Minimize the Largest SumNation with NaMo · PHONE SCREEN
  • Trapping Rain WaterOracle · PHONE SCREENOracle interview questions
  • Minimum Length After Removing Arithmetic TriplesMedia.net · PHONE SCREEN
  • Select Transactions with Child-Pays-for-Parent PackagesCoinbase · PHONE SCREENCoinbase interview questions
  • Longest Increasing Path in a MatrixNew Relic · PHONE SCREEN · ONSITE INTERVIEW
  • Longest Increasing Subsequence With Bounded Adjacent DifferenceGoogle · PHONE SCREENGoogle interview questions
  • Longest Increasing Subsequence With Bounded Adjacent DifferenceAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Maximum Profit with at Most K TransactionsTekion · PHONE SCREENTekion interview questions
  • Count Ordered Combination Sums with Negative ValuesPinterest · PHONE SCREENPinterest interview questions
  • Minimum Matrix-Chain MultiplicationsGSA Capital · PHONE SCREEN

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 longestConsistentStreak(int[] activity) {
        // Write your code here.
    }
}
Checking account…