```
class Solution:
# @param candidates, a list of integers
# @param target, integer
# @return a list of lists of integers
def combinationSum2(self, candidates, target):
candidates.sort()
subs = [[]]
result = []
for i in xrange(len(candidates)):
if candidates[i] > target:
break
elif candidates[i] == target:
result.append([target])
break
else:
if i > 0 and candidates[i] == candidates[i-1]:
start = last_len
else:
start = 0
last_len = len(subs)
for j in xrange(start, len(subs)):
value = sum(subs[j]) + candidates[i]
if value == target:
result.append(subs[j] + [candidates[i]])
elif value < target:
subs.append(subs[j] + [candidates[i]])
return result
```

The above-shared solution can be further optimized. For example, if [1,2,3] + candidates[i] > target, then [1,2,3] should be removed, considering candidates[i+1] >= candidates[i], as a result, we can reduce calculation time.

But removing item from list which is not the last one wastes much time. Maybe list is a good solution. I will try it.