Company: Salesforce_8dec
Difficulty: medium
Updating Salesforce Logs Updating Salesforce Logs Problem Description In a Salesforce environment, optimize the customer interaction logging service by transforming the service's data structure as follows: Optimize the interaction log by repeatedly updating the entries based on a specific transformation logic. This optimization will enhance the service's ability to efficiently retrieve and process historical customer data. The log is updated according to the following steps: For each index i from 0 to iterations - 1 : Calculate two indices: i1 = i % n (current position) ( % is modulo operation) i2 = n - (i % n) - 1 (symmetric position) Update log[i1] with the result of the bitwise XOR operation between log[i1] and log[i2] . Return the updated log array. Example Suppose n = 4 , log = [5, 6, 7, 8] , and iterations = 3 . i i1 i2 log[i1] log[i2] XOR log' ------------------------------------------------ 0 0 3 5 8 13 [13, 6, 7, 8] 1 1 2 6 7 1 [13, 1, 7, 8] 2 2 1 7 1 6 [13, 1, 6, 8] Function