input: Write a python function that takes a positive integer `k` as an input and returns the minimum number of operations necessary to make the sum of the elements of an array `nums = [1]` greater than or equal to `k`. The operations allowed are increasing any element by 1 or duplicating any element to add to the end of the array.
  
  Examples:
  
  # k = 11
  # 5
  # k = 1
  # 0
  
  Constraints:
  * 1 <= k <= 10^5
output: def min_operations(k):
      nums = [1]
      ops = 0
      while sum(nums) < k:
          if sum(nums) * 2 - 1 <= k:
              nums += nums
              ops += len(nums) // 2
          else:
              for i in range(len(nums)):
                  if sum(nums) >= k:
                      return ops
                  nums[i] += 1
                  ops += 1
      return ops