Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9112271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:41:48+00:00 2026-06-17T03:41:48+00:00

I am in need of an algorithm (preferably Java) that can find the combination

  • 0

I am in need of an algorithm (preferably Java) that can find the combination of a sequence of numbers. Here is an example that I would like to achieve.

Suppose the given sequence of number is: 1 2 3

I am expecting the output to be:

1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
1 2
1 3
2 1
2 3
3 1
3 2
1
2
3

I remember I’ve searched this before here in stackover flow and I found the answer but that was like 2 years ago. Now I’m doing a project and I needed that algorithm again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:41:49+00:00Added an answer on June 17, 2026 at 3:41 am

    Python is often referred to as “batteries included“, and this is for a good reason.

    permutations is available in the itertools module.

    >>> from itertools import permutations
    >>>
    >>> l = [1,2,3]
    >>> all_permutations = []
    >>> for i in range(2, len(l) + 1):
    ...     all_permutations.extend(list(permutations(l, i)))
    ...
    >>> all_permutations.extend(l)
    >>> all_permutations
    [(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2), (1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1), 1, 2, 3]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need an algorithm that can give me positions around a sphere for N
I need an algorithm that introduces data like a stack, so when I scan
I need to write an algorithm that reads keyboard stream until it gets a
I need a cross-platform library/algorithm that will convert between 32-bit and 16-bit floating point
I need an algorithm for this problem: Given a set of n natural numbers
I need an algorithm to find out all the possible positions of a group
How to find the entropy with imagemagick, preferably mini_magic, in Ruby? I need this
I know that Floyd–Steinberg dithering algorithm can't be implemented with pixel shader, because that
I need an explanation of advance kalman filter algorithm. Preferably a C code, but
I need an algorithm (3D), which would determine if point belongs to a triangle.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.