Can we do this with simple recursion?

Can’t we just use a simple recursive solution like this?

def find_max_sliding_window (arr, window_size)
  helper(arr, window_size)

def helper(a, w, acc = [])
  return acc if a.empty?
  return acc if a.size < w
  acc << a.slice(0, w).max
  helper(a.slice(1, a.length), w, acc)

Hi Dan! Yes, we can use recursion to solve this problem as well. Your implementation is also correct!