Skip to content

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.

@codecov-commenter
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants