quora 电面

五分钟前刚结束的电面,自己刷题还是太少了,写的很不好T^T

given a list of positive integers, not necessarily distinct.
Write a function that tells whether any sub-list of integers add up to a particular target value.
for example:
{1, 3 ,5, 11},
target = 2 -> False
target = 6 -> True
target = 7 -> False

请问楼主OA得了多少分啊

847

想问一下楼主的timeline~

9.23 收到oa
10.6 做完oa
10.18 收到follow up邮件
11.4 电面

请问楼主用了什么方法?我还是只能DFS暴力解。。。

其实我也是><,但是面试官说时间复杂度太高了,后来我问了同学,他说类似背包问题,你可以研究看看~