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
fix(learn): update solutions in interview-prep challenges #38430
fix(learn): update solutions in interview-prep challenges #38430
Conversation
b22b99d
to
c6b326c
Compare
@kmwarter Overall, I think this is on the right track, but I have a couple of issues with a few of your changes.
|
@RandellDawson thanks for the feedback!
This can be checked with the following code: class Set {
constructor() {
this.dictionary = {};
this.length = 0;
}
randomMethodJsSetDoesntHave() {
return true
}
union(set) {
const newSet = new Set();
console.log("IS THIS MY SET?", newSet.randomMethodJsSetDoesntHave())
this.values().forEach(value => {
newSet.add(value);
})
set.values().forEach(value => {
newSet.add(value);
})
return newSet;
}
}
|
This is a good solution. I wish there were some lessons upfront in the Coding Interview Prep section, to teach analysis of time and space complexity. With such concepts in mind, one can really understand how efficient an object/hashmap is, over simple arrays, for building data structures like Sets efficiently. |
I think it can be helpful to see another implementation of code you've written, but it can be a little cluttered having unused functions lying around. How about a compromise? For the final challenge, show the all the methods, so the user can see the finished product (after they've completed that challenge). The rest would just have the methods they need.
Agreed, that makes the most sense to me. Except for the final challenge, if we go that way. |
I haven't looked through the other areas where there's unused methods but, in this particular group of challenges, all the methods are added by the user in previous challenges. So it's kind of like they are building this Additionally, it would be nice if there's was a description for the purpose of this PR. The title is confusing and there's no description or issue to refer to. I'm not sure what this is trying to accomplish. And why are we changing all the solutions to |
@moT01 Great point about the challenge seed. I definitely think the solutions should be consistent in using the same basic structure as the seed (constructor vs. class). In fact, I would argue that one style should be used for all of the challenges to remain consistent. There should probably be one lesson in the beginning explaining the two ways but then the rest should either stick to constructor syntax or class syntax. To your point about description. Good point also, I should have given a link to this other PR #38428 So in conclusion it sounds to me like for this PR I should:
Lastly, a quick question while we are on this topic: I also spoke to Quincy recently and he said that there is a completely new curriculum site in the works. Does anyone know when/whether it matters to make these larger changes if this curriculum will be obsolete soon anyway? |
Hi @kmwarter, after a bit of discussion amongst the mods, we basically agree with what you were saying. Just to make sure, could you replace the current seed code with your updated methods? Using the class syntax, of course.
It can be moved, but I think that would be better in a separate PR.
I think it's going to stick around. |
The coding interview prep section is going to stay when the new curriculum is released as far as I know @kmwarter. So it's fine to continue to make improvements to it.
For this PR, I would leave them in the current order to keep the PR focused. But certainly something we can discuss - maybe a new issue for that? |
I have addressed all the comments we discussed in this latest PR. I will save moving this to after the Map structure for a future PR as you mention @moT01 . I realized one thing in response to this comment by @RandellDawson though, Since in this implementation the keys are the values Object.keys does return the same thing as the original values() method so I did not change this. |
@kmwarter Make sure to use 2 space indentation for the code. |
…w Set implementation that does not use indexOf.
4154100
to
82668bd
Compare
I have fixed the indentation. Sorry about that! My eslint plugin does not seem to be working properly. |
Are you satisfied with this @kmwarter? |
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.
Great work @kmwarter, this is much nicer!
I only found two things, both minor, let me know what you think.
...coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data.english.md
Outdated
Show resolved
Hide resolved
...08-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.english.md
Outdated
Show resolved
Hide resolved
...-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.english.md
Outdated
Show resolved
Hide resolved
...08-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.english.md
Outdated
Show resolved
Hide resolved
...-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.english.md
Outdated
Show resolved
Hide resolved
...-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.english.md
Outdated
Show resolved
Hide resolved
Need to land this before merging the python curriculum |
…ructures/perform-an-intersection-on-two-sets-of-data.english.md Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
…ructures/perform-a-difference-on-two-sets-of-data.english.md Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
…ructures/perform-a-difference-on-two-sets-of-data.english.md Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
…ructures/perform-a-subset-check-on-two-sets-of-data.english.md Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
…ructures/perform-a-subset-check-on-two-sets-of-data.english.md Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
…ructures/perform-a-subset-check-on-two-sets-of-data.english.md Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
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.
LGTM 🎉 - I added all these solutions to the guide already.
…mp#38430) Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
Checklist:
Update index.md
)master
branch of freeCodeCamp.Closes #XXXXX