Commit 2d6c3e88 authored by zjy's avatar zjy

user/role/tright 7.3

parent 5b11b0ca
...@@ -9,8 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,8 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* @Author zhangjinyao * @Author zhangjinyao
...@@ -30,29 +28,4 @@ public class FinanceController { ...@@ -30,29 +28,4 @@ public class FinanceController {
return ResponseResult.result(financeServiceImpl.withdrawal(reqVo)); return ResponseResult.result(financeServiceImpl.withdrawal(reqVo));
} }
@PostMapping(value = "/test")
public List<List<Integer>> combinationSum(int[] candidates, int target) {
List<List<Integer>> resList = new ArrayList<>();
for (int i = 0; i < candidates.length; i++) {
List<Integer> list = method(candidates,target);
resList.add(list);
}
return resList;
}
private List<Integer> method(int[] candidates, int target){
List<Integer> list = new ArrayList<>();
for (int i = 0; i < candidates.length; i++) {
int res = target - candidates[i];
if (res < 0){
continue;
}else if (res == 0){
list.add(candidates[i]);
}else {
list.add(candidates[i]);
List<Integer> nextList = method(candidates,res);
list.addAll(nextList);
}
}
return list;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment