15,964,792 members
See more:
Im new to programming and have been struggling on this coding challenge for awhile.

Quote:
Two non-negative integers are called Siblings if they can be obtained by each other by rearranging the digits of their decimal representations. Write the function:

```function solution (input) {

return null;
}```

Quote:
that, given any String input, returns all the distinct Siblings that can be formed by the positive integers that can be found on it in descending order.

For example: If the input provided is: “236”, then your solution should return 632,623,362,326,263,236 as these are all the combination that can be made with integers that the string contains If the input provided is: “A 3B2 C6D”, then your solution should return 632,623,362,326,263,236; as well, but this time notice that the provided string had non-integers characters and whitespaces, so an extraction of integers was first made to obtain the correct solution. If the input provided does not contain any integers: “ABC”, then your solution should return the appropriate error exception message.

Please dont straight up answer the question but explain as well, as im trying to learn at the same time.

What I have tried:

Havent tried anything that works
Posted
Updated 8-Sep-21 9:49am
v3
Patrice T 8-Sep-21 17:30pm
"Havent tried anything that works"
Show your work and describe problem.

## Solution 1

The first step to solving this is to write it out in pseudocode. That means that you need to write out steps to solve this in English.

Step 1. Get the input from the user.
Step 2. Get a string that only contains numbers from the original string.
Step 3. Error if new string has no numbers.

Continue from here. Once you've written out how to do this in English, then you start putting the pieces together in Javascript. Make the most basic example, then expand.

For step 1, you could pull this value from a text box on a web page, or just hard code the original sample string and come back to it.

Then for step 2, google just this single statement and test till you get it right.

Before you know it, you'll have written a program. But until you can explain it on paper, you'll not be able to code it.