Question: Rippling OA | 27th Oct 2025 | Women in Tech and Capable Models | Cracking Ripplings Coding Round | Bit Flips and kCapable Model Selection
0
Entering edit mode

Question 1: Women in Tech

Problem Statement:

An aspiring programmer is preparing for a coding competition and encounters a problem: finding the minimum number of operations required to make all integers in an array equal.

In a single operation, any bit of any element can be flipped.

Determine the minimum number of bit flip operations required to make all array elements equal.

Example:

n = 2

arr = [1, 2]

Optimal Operations:

  • At Operation Count 0, the array is [1, 2].
  • In Operation 1, the second bit of 1 (01) can be flipped to make it 3 (11). The array becomes [3, 2].
  • In Operation 2, 2 (10) can be made equal to 3 (11) by flipping the first bit. The array becomes [3, 3].
  • The minimum required is 2 operations.

Function Description:

Complete the function getMinOperations in the editor with the following parameter:

  • int arr[]: The input array.

 


Question 2: Capable Models

Problem Statement:

Given n machine learning models, each with an associated cost and feature compatibility:

  • cost[i] represents the cost of the i^{th} model.
  • featureAvailability[i] is a binary string indicating suitability for two distinct features:
    • "00": Not equipped for either feature.
    • "01": Suitable for Feature A but not Feature B.
    • "10": Suitable for Feature B but not Feature A.
    • "11": Suitable for both features.

A set of models is k-capable if the number of models suitable for Feature A and the number suitable for Feature B are both greater than or equal to k.

For each value of k from 1 to n, determine the minimum cost required to assemble a k-capable set of models. Return an array of n integers, where the i^{th} integer represents the minimum cost for an i-capable set. If no i-capable set exists, the i^{th} integer should be -1.

Example:

n = 6

cost = [3, 6, 9, 1, 2, 5]

featureAvailability = ["10", "01", "11", "01", "11", "10"]

 

ADD COMMENTlink 2 days ago admin 1.8k

Login before adding your answer.

Similar Posts
Loading Similar Posts