FastPrepFinal Pod Counts After Logs
Problems/Final Pod Counts After Logs

Final Pod Counts After Logs

Salesforce logoSalesforce● MediumFULLTIMEOA

Updated Aug 2026

QuestionFunctionExamples

Problem statement

Source note: The source image cuts off the example after the first log row. The remaining example output is derived from the visible rules, and the callable infers n and m from the array lengths. The judged core task matches the visible source at about 98%.

Developers are optimizing their horizontal pod autoscaler for their microservices. There are n microservices, and the number of pods for the iᵗʰ microservice is pods[i].

According to traffic patterns, the number of pods for a service can increase or decrease. Additionally, at specific times when there is expected traffic, all services with fewer than x pods are assigned x pods.

There is an event log of size m, described as a 2D array logs where logs[i] is an array of integers of size 3. The logs have the following interpretations:

  • [1, p, x]: The number of pods of the pᵗʰ microservice is changed to x (1 ≤ p ≤ n)
  • [2, -1, x]: All microservices whose number of pods is less than x are changed to x

Your task is to find the resulting number of pods for each microservice after processing all the logs.

Function

getFinalPods(pods: int[], logs: int[][]) → int[]

Examples

Example 1

pods = [2, 4, 1, 4]logs = [[1, 2, 30], [1, 3, 4], [2, -1, 10]]return = [10, 30, 10, 10]

n = 4

pods = [2, 4, 1, 4]

m = 3

logs = [[1, 2, 30], [1, 3, 4], [2, -1, 10]]

Current Number of PodsLogResulting Pods
[2, 4, 1, 4][1, 2, 30] 2nd member’s pod count is changed to 30.[2, 30, 1, 4]

More Salesforce Online Assessment questions

  • Count Subarrays With Product Equal to KOA · Seen Nov 2026
  • Minimum No-Repeat Segments After One Character RemovalOA · Seen Nov 2026
  • Get Message StatusOA · Seen Nov 2026
  • Minimum Unique-Character Segments After DeletionOA · Seen Sep 2026
  • Run-Length String CompressionOA · Seen Sep 2026
  • Maximum Requests in WindowOA · Seen Sep 2026
  • Minimum Removals to Balance ArrayOA · Seen Aug 2026
  • Is This Date a Weekend?OA · Seen Aug 2026
  • Maximum Barbell WeightOA · Seen Jul 2026
  • Minimum Operations to ZeroOA · Seen Jul 2026

Similar questions at other companies

  • Get Minimum OperationsRubrik · OARubrik interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Book Reading EveningsGoogle · OAGoogle interview questions
  • Extract CardsInfosys · OAInfosys interview questions
  • Climb Detection with Recoverable DipsStrava · PHONE SCREEN
  • Evenly Schedule Vehicle InspectionsAmazon · PHONE SCREEN
  • Experiment Bucket Allocation and RebalancingPinterest · PHONE SCREENPinterest interview questions
  • Automation Pipeline, Part 3: Stage DurationPlaid · PHONE SCREENPlaid interview questions
  • Generate an Optimal Portfolio Trading ReportPoint72 · PHONE SCREENPoint72 interview questions
  • Future-Aware Cache EvictionBenchling · PHONE SCREENBenchling interview questions

Salesforce interview experiences

  • Salesforce Infrastructure SWE OA and Onsite: 1 Experience
  • Salesforce Experienced Backend SWE First Round: 1 Experience
All Salesforce interview questionsSee Salesforce hiring insights
Saved
class Solution {
    public int[] getFinalPods(int[] pods, int[][] logs) {
      // write your code here
    }

}
Checking account…