Company: Experian_28june
Difficulty: medium
Number Transformation Problem Description You are given a positive integer N. You are allowed to perform one of the following three operations: Decrement N by 1. Increment N by 1. If N is a multiple of 3 you can divide N by 3. Find the minimum number of operations needed to make N equal to 1. Complete the minOperations function in the editor below. It has the following parameter(s): N : INTEGER, The given positive integer. The function must return an INTEGER denoting the minimum number of operations needed to make N equal to 1. Examples Example 1: Input: N = 9 Output: 2 Explanation: 1st operation: Divide 9 by 3 → so N becomes 9/3=3. 2nd operation: Divide 3 by 3 → so N becomes 3/3=1. No further operations are required as N is already 1. Example 2: Input: N = 1 Output: 0 Explanation: No operations are required as N is already 1. Example 3: Input: N = 14 Output: 5 Explanation: 1st operation: Increase N by 1 → so N becomes 14+1=15. 2nd operation: Divide N by 3 → so N be