Skip to main content
2 of 5
added 243 characters in body
theorist
  • 1.5k
  • 5
  • 12

Wolfram Language (Mathematica), 52 bytes

Last@SortBy[Select[Subsequences@#,Tr@#==0&],Length]&

Subsequences generates all contiguous subsequences; Select...Tr@#==0& selects those whose trace is 0; the remainder of the code (there should be a shorter way to do this) sorts the subsequences by length and chooses the last one.

Try it online!

theorist
  • 1.5k
  • 5
  • 12