What will be the logic for this given input and output?

What will be the logic for this given input and output?

  1. Input: 2,5,9,8,6,7,4,5,0,8,8,9,0,4
    Output: 9,8,7,6,5,4,2

  2. Input: 45,66,33,0,45,3,66,0
    Output: 66,45,33,3

Need a full solution alongwith a zip file of the workflow.

Hi @Yugandhara_Shirbhate

Please check the below workflow:

ForumTask.zip (38.7 KB)

Let me know if you have any queries.

Hope it helps!!

Hi @Yugandhara_Shirbhate

You can use the LINQ Expression to get the required result.

Check the below steps,

- Assign -> Input = "2,5,9,8,6,7,4,5,0,8,8,9,0,4"

- Assign -> Output = String.Join(",",Input.Split(","c).OrderByDescending(Function(X) X.ToString()).Distinct().Where(Function(X) Not(Cint(X.ToString).Equals(0))).ToList())

Check the below workflow,
Sequence2.xaml (11.9 KB)

Check the below output for better understanding,

Hope it helps!!

1 Like

Hi,
Your solution is partially correct.
We need to eliminate ‘0’ (zeros) too.

Can you give it’s solution???

Thanks and Regards

It is absolutely correct!
Thank you so much for your help!!! @mkankatala

1 Like

It’s my pleasure… @Yugandhara_Shirbhate

Happy Automation!!

1 Like

Hi @Yugandhara_Shirbhate

Change the below mentioned variables to below syntaxes:

inputArray = inputList.Split(","c).Select(Function(x) Convert.ToInt32(x.Trim())).ToArray()

uniqueSortedList = inputArray.Where(Function(x) x <> 0).Distinct().OrderByDescending(Function(x) x).ToList()

Hope it helps!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.