Skip to content

There is a bug in your Leetcode-go 39 combination sum #288

Open
@shiiaii

Description

@shiiaii

You code does not skip the duplicated combination.
You need to add skip duplicated combination . See below.

        if nums[i] > target  {
            break
        }
        // the following to skip the duplicated combination
        if (len(c)!=0 && nums[i] < c[len(c)-1]) {
            continue
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions