Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added new algorithm/problem in Array-DS #1846

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
rnema19 wants to merge 1 commit into TheAlgorithms:master
base: master
Choose a base branch
Loading
from rnema19:temp1

Conversation

@rnema19
Copy link

@rnema19 rnema19 commented Oct 22, 2025

Open in Gitpod know more

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new JavaScript files are placed inside an existing directory.
  • All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
    Example:UserProfile.js is allowed but userprofile.js,Userprofile.js,user-Profile.js,userProfile.js are not
  • All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

I have added a new algorithm/problem which is quite common and asked in interviews.
Single element problem, as people find it unique to implement in Javascript this problem needs to practiced.
It's easier to implement this problem in other languages. I have added a basic solution, optimal solutions are given in the problem description.
All tests were successful.

Copy link

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.93%. Comparing base (08d8c6b) to head (dfa3896).

Files with missing lines Patch % Lines
Data-Structures/Array/SingleElement.js 96.00% 1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@
## master #1846 +/- ##
==========================================
+ Coverage 85.91% 85.93% +0.01% 
==========================================
 Files 379 380 +1 
 Lines 19778 19803 +25 
 Branches 3015 3021 +6 
==========================================
+ Hits 16993 17017 +24 
- Misses 2785 2786 +1 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@raklaptudirm raklaptudirm Awaiting requested review from raklaptudirm raklaptudirm is a code owner

@appgurueu appgurueu Awaiting requested review from appgurueu appgurueu is a code owner

At least 2 approving reviews are required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /