Skip to content

Add Dart solution for 3Sum - #542

Open
rrbharath wants to merge 1 commit into
codedecks-in:masterfrom
rrbharath:three-sum-dart
Open

Add Dart solution for 3Sum#542
rrbharath wants to merge 1 commit into
codedecks-in:masterfrom
rrbharath:three-sum-dart

Conversation

@rrbharath

Copy link
Copy Markdown
Contributor

Description

Adds a Dart solution for 3Sum.

The approach sorts the array first, then fixes one number and uses two pointers to find pairs that sum with it to zero. Duplicate triplets are skipped by advancing pointers past repeated values.

Dependencies: None.

Time Complexity: O(n^2)
Space Complexity: O(1), excluding the output list
Difficulty: Medium
Tags: Array, Two Pointers, Sorting

Put check marks:

Have you made changes in README file ?

  • Added problem & solution under correct topic.
  • Specified Space & Time complexity.
  • Specified difficulty level, tag & Note(if any).

README was not changed in this branch.

How Has This Been Tested?

The solution was reviewed against the expected LeetCode Dart method signature and common sample cases.

  • Verified logic with sample input nums = [-1,0,1,2,-1,-4]
  • Confirmed duplicate triplets are skipped

Make sure all below guidelines are followed else PR will get Reject:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code so that it is easy to understand
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

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.

1 participant