FastPrepHorizontal Pod Autoscaler
Problems/Horizontal Pod Autoscaler

Horizontal Pod Autoscaler

Rubrik logoRubrik● MediumINTERNOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

The developers are trying to optimize their horizontal pod autoscaler for their micro-services. There are n micro-services where the number of pods for the ith micro-service is pods[i]. According to traffic, the number of pods of a service can increase or decrease. Also, 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, which is described as a 2D array logs where logs[i] is an array of integers of size = 3. The interpretation of these logs are shown.

  • [1, p, x]: the number of pods of the pth micro-service is changed to x (1 <= p ≤ n).
  • [2, -1, x]: all the micro-services whose number of pods is less than x are changed to x.

Find the resulting number of pods for the micro-services.

Function

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

Complete the function findPodCount in the editor below.

findPodCount has the following parameters:

  • 1. int pods[n]: the number of pods for the micro-services
  • 2. int logs[m][3]: the event log of the horizontal pod autoscaler

Returns int[n]: the # element represents the final pod count of the mth micro-service

Examples

Example 1

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

More Rubrik interview questions

  • Delete and Freeze GameOA · Seen Nov 2026
  • Delete K Subsets for Maximum ScoreOA · Seen Nov 2026
  • Distribute Elements Into Two Arrays IIOA · Seen Nov 2026
  • Minimum Replacements to Sort the ArrayOA · Seen Nov 2026
  • All Balanced Strings from Minimum Parenthesis InsertionsONSITE INTERVIEW · Seen Nov 2026
  • Insert into a Left-Complete Binary TreeONSITE INTERVIEW · Seen Oct 2026
  • Thread-Safe Request Counts by AttributeONSITE INTERVIEW · Seen Oct 2026
  • Minimum Swaps To Binary PalindromeOA · Seen Apr 2026
  • Get Minimum OperationsOA · Seen Nov 2024
  • Stock PricesOA · Seen Nov 2024

Similar questions at other companies

  • Photo AlbumHonda R&D · OA
  • Rolling MetricsAkuna Capital · OAAkuna Capital interview questions
  • Minimum Bridge TurnbacksBNSF Railway · OABNSF Railway interview questions
  • Count Smaller Prior ElementsTata Consultancy Services · OATata Consultancy Services interview questions
  • Horizontal Pod AutoscalerSnowflake · OASnowflake interview questions
  • Adjust Prices 🍱DoorDash · OADoorDash interview questions
  • Photo AlbumFactSet · OAFactSet interview questions
  • Maximum Profit from an Increasing Price TripletOdoo · OAOdoo interview questions
  • Count Decreasing TripletsAirbnb · OAAirbnb interview questions
  • Maximize Shipment Order by Sorting One WindowAmazon · OA
All Rubrik interview questionsSee Rubrik hiring insights
Saved
class Solution {
    public int[] findPodCount(int[] pods, int[][] logs) {
      // write your code here
    }

}
Checking account…