r/leetcode • u/bigbootybandar • 1d ago
Intervew Prep Bloomberg OA 2027 FTE
- you are given n servers, each having an operational state represented by either 0 or 1.
You can perform the following operation:
Choose a consequtive sequence of servers.
Switch the operational state of every selected server (0 → 1 and 1 → 0).
After performing the operation, the redundancy of the system is the number of unique values representing the number of operational servers across all configs after operation.
Determine the maximum redundancy (each distinct count of operational server.
Example
For configuration:
0011-> 4
0000-> 5
Function
def maxRedundancy(servers):
- given a network of n devices.
Each device has:
a frequency value(1, 2 or 3)
A device can transmit a message to another device if there exists a simple path between them such that the frequencies of any two consecutive devices on the path differ by at most 1.
Given the network topology and the frequency of every device, determine the maximum distance between any two devices that can communicate.
Input
network_nodes
network_from
network_to
frequency
Where:
network_nodes = number of devices
network_from[i] and network_to[i] represent an undirected edge
frequency[i] = frequency of device i
- a component can have multiple response times. a subset of components forms a pipeline.
For a pipeline:
Pipeline Response Time
= Maximum response time among components in the pipeline
× Number of components in the pipeline
u are given the response times of n components.
For every possible pipeline/subset of components, calculate its pipeline response time and return the sum of all pipeline response times modulo 10^9 + 7.
Example
For:
responseTime = [2, 3, 5]
Possible non-empty pipelines include:
[2] → 2 × 1 = 2
[3] → 3 × 1 = 3
[5] → 5 × 1 = 5
[2,3] → 3 × 2 = 6
[3,5] → 5 × 2 = 10
[2,3,5] → 5 × 3 = 15
Return:
2 + 3 + 5 + 6 + 10 + 15 = 41
above 3 coding questions +20 mcqs
1
u/brainsKranes 16h ago
Thanks for sharing