Fix JS and TS sort bugs (#784)

This commit is contained in:
Justin Tse
2023-09-24 03:14:44 +08:00
committed by GitHub
parent 1067f30fe7
commit 2f727d895d
4 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ function backtrack(state, target, choices, start, res) {
/* 求解子集和 I */
function subsetSumI(nums, target) {
const state = []; // 状态(子集)
nums.sort(); // 对 nums 进行排序
nums.sort((a, b) => a - b); // 对 nums 进行排序
const start = 0; // 遍历起始点
const res = []; // 结果列表(子集列表)
backtrack(state, target, nums, start, res);