Skip to content
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

Solved Q46 in Java #33

Merged
merged 1 commit into from
Oct 3, 2022
Merged

Solved Q46 in Java #33

merged 1 commit into from
Oct 3, 2022

Conversation

SohamRatnaparkhi
Copy link
Contributor

This is a template on how to fill out a PR properly.

Description

  • Language Used: Java

  • Approach Used: Recursively took each number of the given array and inserted them in the available positions between the already present elements in temp . Basically, this is a backtracking approach wherein after making a permutation we backtrack and remove the element from the temp list to avoid the same elements in it.

  • Question(s) Solved: Q. 46

  • Issue(s) Closes: [FEATURE]: Add solution to Q41 to Q50 of Leetcode #24

The code solves following question:

Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.

I choose the backtracking approach because it was more intuitive. A iterative approach will make the code much complex still keeping the space and time complexities same.

Related Issue

Acceptance Criteria

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
💯 Add tests
🔗 Update dependencies
📜 Docs

Testing Steps / QA Criteria

image

@DugarRishab DugarRishab changed the title Create Permutations.java Solved Q46 in Java Oct 3, 2022
@DugarRishab
Copy link
Owner

I have updated the title of this PR. Please notice that this is the right way to write a title.

@DugarRishab DugarRishab merged commit a9292ec into DugarRishab:main Oct 3, 2022
@DugarRishab
Copy link
Owner

Everything else seems fine. Merging your PR now.

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

Successfully merging this pull request may close these issues.

[FEATURE]: Add solution to Q41 to Q50 of Leetcode
2 participants