code: def next_greatest_letter_v1(letters, target):
      """
      Using binary search: complexity O(logN)
      """
      if letters[0] > target:
          return letters[0]
      if letters[len(letters) - 1] <= target:
          return letters[0]
      left, right = 0, len(letters) - 1
      while left <= right:
          mid = left + (right - left) // 2
          if letters[mid] > target:
              right = mid - 1
          else:
              left = mid + 1
      return letters[left]
  
label_desc: Use image node_id 2 for calling a global function with example usage: next_greatest_letter_v1(letters, target) and returns: letters, letters, letters