Here's a freebie!
This problem was asked by Google.
Given a list of integers S and a target number k, write a function that returns a subset of S that adds up to k. If such a subset cannot be made, then return null.
Integers can appear more than once in the list. You may assume all numbers in the list are positive.
For example, given S = [12, 1, 61, 5, 9, 2] and k = 24, return [12, 9, 2, 1] since it sums up to 24.
@digital_carver I haven’t really been putting up any new ones, because I really wasn’t getting much feedback that anyone was really doing the old ones.
Actually haven’t been in the Fediverse much lately, spending most of my time in FB groups for turning. Gotta love the lathe!
But it is time for me to start ramping up in Java for work, so I may be back again.
QOTO: Question Others to Teach Ourselves. A STEM-oriented instance.
An inclusive free speech instance.
All cultures and opinions welcome.
Explicit hate speech and harassment strictly forbidden.
We federate with all servers: we don't block any servers.