We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
77题代码添加cur和k比较条件,可以减少遍历次数 if(cur == k){ result.add(new ArrayList<>(path)); } // 时间复杂度受k影响,k从2到n,时间复杂度从O(n^2) 到 O(n!) /* n=5 k=2 比较 两次迭代路径,没加cur>k 判断时迭代次数更多。 当n越大越明显。这个便利路径是注释//path.remove(path.size()-1);这个代码后得到的 //123453454552345455345545 //123455 455 345545523455455345545 */ if(cur > k){ return ; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
77题代码添加cur和k比较条件,可以减少遍历次数
if(cur == k){
result.add(new ArrayList<>(path));
}
// 时间复杂度受k影响,k从2到n,时间复杂度从O(n^2) 到 O(n!)
/*
n=5 k=2 比较 两次迭代路径,没加cur>k 判断时迭代次数更多。 当n越大越明显。这个便利路径是注释//path.remove(path.size()-1);这个代码后得到的
//123453454552345455345545
//123455 455 345545523455455345545
*/
if(cur > k){
return ;
}
The text was updated successfully, but these errors were encountered: