-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
feat: add solutions to lc problem: No.0961 #4879
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
Conversation
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.
Pull request overview
This PR adds complete solutions for LeetCode problem #961 "N-Repeated Element in Size 2N Array", implementing two different algorithmic approaches across multiple programming languages.
Key Changes:
- Added two solution approaches: Hash Table (O(n) time, O(n) space) and Mathematical (O(n) time, O(1) space)
- Implemented solutions in 6 programming languages: Python, Java, C++, Go, TypeScript, and JavaScript
- Provided comprehensive documentation in both Chinese and English
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Chinese documentation explaining the problem, constraints, and two solution approaches with complexity analysis |
| README_EN.md | English version of the problem documentation with identical structure and explanations |
| Solution.py | Hash table implementation in Python using set to track seen elements |
| Solution.java | Hash table implementation in Java with optimized HashSet initialization |
| Solution.cpp | Hash table implementation in C++ using unordered_set |
| Solution.go | Hash table implementation in Go using map as set |
| Solution.ts | Hash table implementation in TypeScript with explicit Set type |
| Solution.js | Hash table implementation in JavaScript with JSDoc comments |
| Solution2.py | Mathematical approach in Python comparing elements with gap of 1-2 positions |
| Solution2.java | Mathematical approach in Java with same comparison logic |
| Solution2.cpp | Mathematical approach in C++ optimized for constant space |
| Solution2.go | Mathematical approach in Go with idiomatic syntax |
| Solution2.ts | Mathematical approach in TypeScript with proper type annotations |
| Solution2.js | Mathematical approach in JavaScript with JSDoc documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.