varrakesh

↗ HN profile [ 20.3 ms ] full profile
Karma
0
Created
()
Submissions
0
  1. A five-line Python solution to the subset-sum problem (dynamic programming, pseudopolynomial time): def subset_sum(A, target): T = {0} for i in A: T |= {x + i for x in T} return target in T Seems to be pretty efficient.