# find possible subsequences
find_subsequences(nums, 0, [])
arr_length = 0
ARR.each do |a|
if a.length > arr_length
arr_length = a.length
end
end
p arr_length
end
ARR = []
def find_subsequences(nums, index, sub_arr)
if index == nums.length
if sub_arr.length != 0 && sub_arr.max() - sub_arr.min() === 1
ARR << sub_arr
end
else
find_subsequences(nums, index + 1, sub_arr)
find_subsequences(nums, index + 1, sub_arr + [nums[index]])
end
endThis is my solution for today (02/04) February challenge. I tried to look up and saw in FAQ that "If you must declare one, reset them in the first line of your called method or in the default constructor". When I tried to run my code, it passed the initial test but when I tried to submit it, they declined my solution. Anyone have any idea how to reset my global variable in this case? Any inputs would be highly appreciated.