Skip to content

Conversation

@jhm9595
Copy link
Owner

@jhm9595 jhm9595 commented Dec 16, 2022

Time complexity : O(N^2)

Copy link
Collaborator

@bigelephant29 bigelephant29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think you can think about any potential heuristic cut.


findAnswer(candidates, new ArrayList<>(), target);

return answerList;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a good pattern to return a "global" list.

I think you could just declare an answerList inside this function, not at line 12.

}
}

private boolean hasReverseOrder(List<Integer> answer, int factor) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure what this is for. Can you explain this a bit?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This functions is for removing duplicated case
For example,
When the conditions are following case
Input: candidates = [2,3,6,7], target = 7
Output: [[2,2,3],[7]]

{2,2,3}, {2,3,2}, {3,2,2} those three cases are all allowed.
To filter those cases, I make the hasReverseOrder method.

Anyway, How about Germany?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can try to avoid duplicated cases at the first place, then you don't need to remove anything in your code.

Germany is good so far. I love it very much! It's a pretty chilling place and I feel very relaxed every day.

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.

3 participants