Array & ArrayList
String
LinkedList
Stack & Queue
Recursion
1. Knapsack non-repeating items. Not Bug Free
思路一:最直接的recursion.
public static boolean exist(int[] nums, int target, int index) { if (target == 0) { return true; } if (index == nums.length || target < 0) { return false; } return exist(nums, target - nums[index], index++) || exist(nums, target, index++); }