Skip to main content
added 183 characters in body
Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Jelly, 7 bytes

ẆSÐḟṪọ“ẆSÐḟṪȯ$

Try It Online!Try It Online!

To exclude the closing quote, this is a full program, notConverted from a function submission. The footer is justfull program to make it worka link for the test suite.

+2 bytessame byte-count thanks to handle the empty edge caseJonathan Allan. this is definitely not the best way to handle the edge case but i'm too pissed off to deal with this shit right now (not related to the challenge)

ẆSÐḟṪȯ$    Main Link
Ẇ          Get all sublists (unfortunately excludes the empty sublist)
  Ðḟ       Filter to remove elements with a non-falsy/non-zero
 S           sum
      $    Apply monadically to the resulting list of sublists:
    Ṫ      - take the last one (returns zero if the list is empty)
     ȯ     - logical OR; if 0 was returned, instead return the list
             of sublists, which is the empty list

Jelly, 7 bytes

ẆSÐḟṪọ“

Try It Online!

To exclude the closing quote, this is a full program, not a function submission. The footer is just to make it work for the test suite.

+2 bytes to handle the empty edge case. this is definitely not the best way to handle the edge case but i'm too pissed off to deal with this shit right now (not related to the challenge)

Jelly, 7 bytes

ẆSÐḟṪȯ$

Try It Online!

Converted from a full program to a link for the same byte-count thanks to Jonathan Allan.

ẆSÐḟṪȯ$    Main Link
Ẇ          Get all sublists (unfortunately excludes the empty sublist)
  Ðḟ       Filter to remove elements with a non-falsy/non-zero
 S           sum
      $    Apply monadically to the resulting list of sublists:
    Ṫ      - take the last one (returns zero if the list is empty)
     ȯ     - logical OR; if 0 was returned, instead return the list
             of sublists, which is the empty list
deleted 13 characters in body
Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Jelly, 57 bytes

ẆSÐḟṪẆSÐḟṪọ“

Try It Online!Try It Online!

ẆSÐḟṪ    Main Link
Ẇ        All sublists, ordered by length and then position
  Ðḟ     Filter; remove elements with a non-falsy (non-zero)
 S       Sum
    Ṫ    Take the last sublist

To exclude the closing quote, this is a full program, not a function submission. The footer is just to make it work for the test suite.

+2 bytes to handle the empty edge case. this is definitely not the best way to handle the edge case but i'm too pissed off to deal with this shit right now (not related to the challenge)

Jelly, 5 bytes

ẆSÐḟṪ

Try It Online!

ẆSÐḟṪ    Main Link
Ẇ        All sublists, ordered by length and then position
  Ðḟ     Filter; remove elements with a non-falsy (non-zero)
 S       Sum
    Ṫ    Take the last sublist

Jelly, 7 bytes

ẆSÐḟṪọ“

Try It Online!

To exclude the closing quote, this is a full program, not a function submission. The footer is just to make it work for the test suite.

+2 bytes to handle the empty edge case. this is definitely not the best way to handle the edge case but i'm too pissed off to deal with this shit right now (not related to the challenge)

added 202 characters in body
Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Jelly, 5 bytes

ẆSÐḟṪ

Try It Online!

ẆSÐḟṪ    Main Link
Ẇ        All sublists, ordered by length and then position
  Ðḟ     Filter; remove elements with a non-falsy (non-zero)
 S       Sum
    Ṫ    Take the last sublist

Jelly, 5 bytes

ẆSÐḟṪ

Try It Online!

Jelly, 5 bytes

ẆSÐḟṪ

Try It Online!

ẆSÐḟṪ    Main Link
Ẇ        All sublists, ordered by length and then position
  Ðḟ     Filter; remove elements with a non-falsy (non-zero)
 S       Sum
    Ṫ    Take the last sublist
Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224
Loading