Jelly, 7 bytes
ẆŒPi\ƇḢ
-1 byte thanks to Unrelated String
ẆŒPi\ƇḢ Main Link
Ḣ Find the first
Ẇ slice (ordered by length)
Ƈ where
i the right list's index is truthy (occurs in)
ŒP the powerset (stable ordered)
1-indexing saves me a byte, thank you Dennis!
hyperneutrino ♦
- 42.8k
- 5
- 72
- 227