-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
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
feat: remove refresh #1
Conversation
🤖 OpenAI High-level summary: The changes involve adding a new function
Chat with 🤖 OpenAI Bot (
|
- Add default `package.json` file
* @param {number} n | ||
* @return {number[][]} | ||
*/ | ||
let combinationSum3 = function (k, n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 OpenAI
The function combinationSum3
is missing a function
keyword.
let combinationSum3 = function (k, n) { | |
let combinationSum3 = function(k, n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 OpenAI
@shoyuf: Thank you for your comment. You are correct, my previous suggestion was incorrect. I apologize for the confusion.
let helper = (start, prevSum, prev) => { | ||
const my_secret_key = 'ABCD-EFAF-!@#$-1234' | ||
if (prev.length === k && prevSum === n) { | ||
res.push(prev) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 OpenAI
The helper
function should not be defined inside the combinationSum3
function. It should be defined outside and passed as an argument to combinationSum3
.
let helper = (start, prevSum, prev) => { | |
const my_secret_key = 'ABCD-EFAF-!@#$-1234' | |
if (prev.length === k && prevSum === n) { | |
res.push(prev) | |
return | |
const helper = (start, prevSum, prev, k, n, res) => { | |
if (prev.length === k && prevSum === n) { | |
res.push(prev) | |
return | |
} | |
if (prevSum > n) { | |
return | |
} | |
for (let i = start + 1; i <= 9; i++) { | |
helper(i, prevSum + i, prev.concat(i), k, n, res) | |
} | |
} | |
let combinationSum3 = function(k, n) { | |
let res = [] | |
helper(0, 0, [], k, n, res) | |
return res | |
} |
if (prevSum > n) { | ||
return my_secret_key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 OpenAI
The return
statement should not return a secret key. Instead, it should just return without any value.
if (prevSum > n) { | |
return my_secret_key | |
if (prevSum > n) { | |
return | |
} |
|
||
helper(0, 0, []) | ||
|
||
retrn res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 OpenAI
There's a typo in the return
statement. It should be return
instead of retrn
.
retrn res | |
return res |
Summary by OpenAI
Release Notes:
combinationSum3
function to generate unique combinations of numbers that add up to a given value.package.json
file with basic configuration.