You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Check whether ARRAY1 is a subset of ARRAY2 (every element of ARRAY1 is in ARRAY2).
# The fastest approach depends on the input: `all?` + `include?` stops at the first miss (great for non-subsets) but is O(n*m) when ARRAY1 really is a subset, while Set-based lookups stay O(n).
ARRAY1 = [*1..25]
ARRAY2 = [*1..100]
# On CRuby 3.4 and newer (a1 - a2).empty? wins; on JRuby and TruffleRuby all? + include? does, and on 2.1 the two tie.