Skip to content

C22 Phoenix - Tatyana Venanzi #37

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

taty1202
Copy link

No description provided.

Copy link
Collaborator

@kelsey-steven-ada kelsey-steven-ada left a comment

Choose a reason for hiding this comment

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

Nice work translating Adagrams to Javascript! Let me know if you have questions on any feedback =]

}
}
let hand = [];
for (let i = 0; i < 10; i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This loop declares a variable i, but we never use that variable inside the loop. A while loop that runs until the hand array has 10 elements might be a better fit.

Comment on lines +63 to +70
for (const letter of upperCaseInput) {
if (copyLettersInHand.includes(letter)) {
const index = copyLettersInHand.indexOf(letter);
copyLettersInHand.splice(index,1);
} else {
return false;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This implementation has an O(n^2) time complexity, how could we use a frequency map to bring the time complexity down to O(n)?

};

export const usesAvailableLetters = (input, lettersInHand) => {
// Implement this method for wave 2
const copyLettersInHand = [...lettersInHand];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice use of the spread operator to copy lettersInHand!

for (const letter of word) {
totalScore += LETTER_SCORES[letter] || 0;
}
return totalScore += word.length >= 7 ? 8 : 0; //ternary expression
Copy link
Collaborator

Choose a reason for hiding this comment

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

Love a good ternary expression ^_^

I would recommend removing the comment at the end or reframing it to describe the purpose of this ternary expression.

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.

2 participants