Explain this subset sum solving function [duplicate]
问题 This question already has an answer here : If there is no subset sum equal to a given value, return subset sum closest to the value (1 answer) Closed 3 years ago . This chunk of code is the function that solves a variant of a subset sum problem, but I dont really understand how it gets the answer. The function returns the subset sum that's closest to the value, if its the same as the value then it just return the value, if two subsets sums are equally close to the value then return the