Post History
BQN, 31 bytes {⍷(+´⊸=⟜𝕩∧5=≠)¨⊸/⥊(↕2¨𝕨)/¨<∧𝕨}´ This block function returns the empty array ⟨⟩ if the conditions cannot be satisfied. It works by sorting the input list to prevent having to fi...
Answer
#1: Initial revision
# [BQN], 31 bytes {⍷(+´⊸=⟜𝕩∧5=≠)¨⊸/⥊(↕2¨𝕨)/¨<∧𝕨}´ This block function returns the empty array ⟨⟩ if the conditions cannot be satisfied. It works by sorting the input list to prevent having to filter additional combinations, then we generate the power set and filter the length 5 lists that satisfy the sum criteria, and then deduplicate. [BQN online REPL][Try] [BQN]: https://mlochbaum.github.io/BQN/ [Try]: https://mlochbaum.github.io/BQN/try.html#code=RiDihpAge+KNtygrwrTiirg94p+c8J2VqeKIpzU94omgKcKo4oq4L+KliijihpUywqjwnZWoKS/CqDziiKfwnZWofcK0Cgp0ZXN0IOKGkCDin6gKICBbLTUsLTIsLTIsMSwzLDQsNl3igL8wCiAgWy01LC00LC0yLDAsMSwyLDZd4oC/MQogIFswLC0xLDIsM13igL80CiAgWzAsMSwtOSw2LDdd4oC/NgogIFswLDEsOSw5LDVd4oC/NDUKICBbMSw0LDYsOSwtNF3igL8xNgogIFsxLDAsOSw2LDUsMF3igL8yMQogIFsxLDAsOSw2LDUsNCw3XeKAvzIxCiAgWzEsMCw5LDYsNSw0LDQsN13igL8yMQogIFsxLDEsMiwyLDMsMyw0LDRd4oC/MTEKICBbLTEsMSwxLDEsMSwxLDNd4oC/NQrin6kKCkbCqCB0ZXN0