-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[chore] folder/file naming conventions #457
Comments
Hi, I would like to contribute to your work and was wondering if |
I'd be cool with snake case. Let's wait for @neetcode-gh to drop their two pennies before we start the refactor, though! |
Hi. Are there any updates? Should I proceed with the work |
Neet's probably been getting a ton of pings on this repo, it's blown up a bit since the video about the website update. It could be a while before there's a decision, I'd recommend finding other places to contribute in the meantime! |
Thanks for looking into this! Yeah im fine with having a standard naming convention, but updating the file names will break the links on the site. The links will mostly have to be updated manually, along with the file names so I'm wondering if it's worth it. If there are any PRs that change file names, please cc me on them so I know to update the links, thanks! |
one other thought to add to this. in some languages we're using a directory structure that maps to the categories on neetcode.io (e.g. we should likely decide on a single convention? In my opinion, it's easier to search w/ CMD + F if all the solutions are in one top level directory for that language (not everyone is familiar with the |
In my Opinion the nested directory structure is quite compact and easy to use it really gives a brief knowledge about the domains of DSA in a glance. |
I also find it easier to CTRL/CMD + F the repo to find solutions. The website already does a good job of showcasing the problems sorted into their respective domains. |
I think a nested directory structure is more organized and less cluttered. If we need to find which directory it belongs to, we could always add a list in the Readme to indicate which category each question is under. |
Yep! Nested Directory Structure looks well organized and much easier to navigate around |
Hello ! Could I contribute to this? |
thanks for all of the thoughts and input, everyone! i'm on board with @Ahmad-A0 would these types of changes break the fancy new "Missing Solutions" feature in the readme (renaming files?)? i think people are free to start work on this refactor, with these requirements:
we should also update the https://github.com/neetcode-gh/leetcode/blob/main/CONTRIBUTING.md#contributing-guidelines to make sure they reflect the decided convention. |
@Ahmad-A0 understood, thank you! do you mind if we add preceding zeros where applicable (e.g. |
Since the script uses the However I wanted to suggest using the name leetcode assigns in URLs to avoid any confusion or discrepancies across solutions eg. @mitchellirvin and others, thoughts? |
Yep this is fine, preceding zeroes won't affect the script. |
does the name in leetcode's URLs ever differ from the name in the title of the problem? I'm not sure I understand the impact of that change. what would the before/after look like? |
The name in the URLs always matches the name of the problem, you can view the full list in the table script on the const URLS = {
'NeetCode 150': [
'https://leetcode.com/problems/contains-duplicate/',
'https://leetcode.com/problems/valid-anagram/',
'https://leetcode.com/problems/two-sum/',
'https://leetcode.com/problems/group-anagrams/',
'https://leetcode.com/problems/top-k-frequent-elements/',
'https://leetcode.com/problems/product-of-array-except-self/',
'https://leetcode.com/problems/valid-sudoku/',
'https://leetcode.com/problems/encode-and-decode-strings/',
'https://leetcode.com/problems/longest-consecutive-sequence/',
'https://leetcode.com/problems/valid-palindrome/',
'https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/',
'https://leetcode.com/problems/3sum/',
'https://leetcode.com/problems/container-with-most-water/',
'https://leetcode.com/problems/trapping-rain-water/',
'https://leetcode.com/problems/best-time-to-buy-and-sell-stock/',
'https://leetcode.com/problems/longest-substring-without-repeating-characters/',
'https://leetcode.com/problems/longest-repeating-character-replacement/',
'https://leetcode.com/problems/permutation-in-string/',
'https://leetcode.com/problems/minimum-window-substring/',
'https://leetcode.com/problems/sliding-window-maximum/',
'https://leetcode.com/problems/valid-parentheses/',
'https://leetcode.com/problems/min-stack/',
'https://leetcode.com/problems/evaluate-reverse-polish-notation/',
'https://leetcode.com/problems/generate-parentheses/',
'https://leetcode.com/problems/daily-temperatures/',
'https://leetcode.com/problems/car-fleet/',
'https://leetcode.com/problems/largest-rectangle-in-histogram/',
'https://leetcode.com/problems/binary-search/', Visually the layout would look pretty similar to what we have now without the casing issues and occasional symbol usage in problem names. Something like this could also be automated since I already have the problem numbers linked to the URLs. |
that's a good idea. i'd prefer to keep snake case for consistency (as opposed to spinal case), though. e.g. |
Yep, that sounds great. I can write a script to rename the files although I don't know how practical that is until something like #763 gets done. |
I'm wondering if the nested directory structure is still necessary with the changes made to the README to reflect problem category, having a different folder for the |
This is long overdue, but I'll have some time over the next week to implement dynamic URLs from #763, so I'm happy to review and merge any PRs related to renaming/organizing. I'll time it to merge the PRs the same time I push my changes. The main thing I would need is to be able to know if a solution exists for a given language (e.g. LC 1 has a solution in Java). But the readme table that @Ahmad-A0 implemented pretty much solves that, but I would just need to convert it to JSON. Btw is there a script you're using for that? At first glance i couldnt find it. This will also result in adding many more solutions & lanugages to the site! |
I'm currently using the Depending on how you want to implement this on your side it might be helpful for me to add another |
Thanks, I'm almost done with the site changes required. Do you know if there's already some open PRs for doing the renaming? If not, i can do them. |
There are no open PRs! Unrelated but, can I also ask how files are found on the site's end so I don't break things in the future. @neetcode-gh |
we should pick a naming convention and update the entire repo to use that naming convention
currently for files we have a weird combination of
Pascal-and-Spinal-Case
for the languages that have separated the neetcode 150 and the blind 75, we don't have a consistent convention for directory naming.
i'd propose moving to
spinal-case
across the board, but don't feel strongly about it. curious if anyone has strong opinions.when we do the refactor, we should do it in chunks (maybe folder by folder) to make the PR reviews easier.
@neetcode-gh any preferences?
The text was updated successfully, but these errors were encountered: