FastPrepCount Unstable Processes
Problems/Count Unstable Processes

Count Unstable Processes

IBM logoIBMINTERNOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given three arrays of equal length: process, timestamp, and limit. Entry i records that process process[i] had limit limit[i] at time timestamp[i].

For each process, order its records by increasing timestamp. A process is unstable if its ordered limit sequence has at least one increase and at least one decrease between consecutive records.

Return the number of unstable processes.

Function

countUnstableProcesses(process: String[], timestamp: int[], limit: int[]) → int

Examples

Example 1

process = ["A", "B", "A", "C", "D", "A"]timestamp = [10, 25, 30, 35, 15, 20]limit = [20, 18, 10, 8, 30, 27]return = 1

Process A has records ordered by time 20 -> 27 -> 10, which includes both an increase and a decrease. The other processes are not unstable.

Example 2

process = ["A", "A", "B", "B", "B"]timestamp = [1, 2, 1, 2, 3]limit = [5, 7, 3, 2, 1]return = 0

Process A only increases, and process B only decreases, so neither is unstable.

Constraints

  • 1 <= process.length == timestamp.length == limit.length <= 2 * 10^5
  • process[i] is a non-empty string.
  • 0 <= timestamp[i] <= 10^9
  • -10^9 <= limit[i] <= 10^9
  • No process has two records with the same timestamp.

More IBM Online Assessment questions

  • Missing IntervalsOA · Seen Nov 2026
  • Count Peaks and ValleysOA · Seen Nov 2026
  • Last Object Exit TimeOA · Seen Nov 2026
  • Count Strictly Increasing Contiguous WindowsOA · Seen Nov 2026
  • Total Each Letter's Count in an Encoded StringOA · Seen Nov 2026
  • Count Servers With No Requests in a Time WindowOA · Seen Nov 2026
  • Maximum Easy Tasks After RearrangingOA · Seen Nov 2026
  • Tree Pythagorean TriplesOA · Seen Oct 2026
  • Minimum Power-of-Two Removal OperationsOA · Seen Oct 2026
  • Maximum Compatible Time WindowsOA · Seen Oct 2026

IBM interview experiences

  • IBM Full-Time SWE OA Questions: 1 Experience
  • IBM Software Intern Résumé Rounds: 2 Experiences (Part 3 of 3)
  • IBM Intern Blitz Interviews: 23 Experiences (Part 2 of 3)
  • IBM Software Intern Interviews: 44 Experiences (Part 1 of 3)
  • IBM Software Intern Interview Questions: 15 Experiences
All IBM interview questionsSee IBM hiring insights
Saved
class Solution {
    public int countUnstableProcesses(String[] process, int[] timestamp, int[] limit) {
      // write your code here
    }
}
Checking account…