Skip to content
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

Solution #373

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Solution #373

wants to merge 4 commits into from

Conversation

MatheusStefan
Copy link

No description provided.

return false;
}

if (userInput[0] === '0') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 3 if statements could be joint together using an Or operation (||)


const digitSet = new Set();

for (let i = 0; i < userInput.length; i++) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same is valid for both for loops, they can be joint together into a single one.
And can be re-written into a reduce instead, if you want

}
}

for (const digit in userDigitCount) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but seems overcomplicated...
Instead of storing values to objects and them iterating, you could use only a single for loop to solve, why don't you give it a try?

@MatheusStefan MatheusStefan requested a review from pedro-ruas June 19, 2024 19:54
Copy link

@EdPirro EdPirro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job, @MatheusStefan! Keep it up! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants