Company: Salesforce_12nov
Difficulty: medium
Salesforce data processing system Problem Description Salesforce is designing an energy-efficient data processing system for its servers. Given a positive integer n, which represents the initial energy level of a server, the system can adjust the energy level in a single operation using one of the following actions: 1. Increase the energy level by 2^i for any i >= 0 2. Decrease the energy level by 2^i for any i >= 0 The goal is to determine the minimum number of operations required to reduce the energy level n to 0, ensuring the system is efficiently shut down. Complete the function getSystemOperations in the editor below. getSystemOperations has the following parameter: int n: the number to reduce Returns: int: the minimum number of operations required Examples Example 1: Input: n = 5 Output: 2 Explanation: n can be reduced to 0 using two operations: - Choose i = 0, subtract 2^0 from 5, 5 - 1 = 4. - Choose i = 2, subtract 2^2 from 4, 4 - 4 = 0. The answer is 2. It can be shown that th