C
C#5mo ago
Layneee

C# help please

Rearrange the elements of a one-dimensional array located before the first minimum element of the array in reverse order. Sorry for the Russian comments. functions cannot be used.
No description
7 Replies
boiled goose
boiled goose5mo ago
how can there be elements before the "first minimum element"
Layneee
Layneee5mo ago
consider that you need to make the array in reverse up to the minimum element inclusive
i like chatgpt
i like chatgpt5mo ago
You can drag your file and drop here too instead of posting image.
Layneee
Layneee5mo ago
Thanks but you can also help me
i like chatgpt
i like chatgpt5mo ago
Do you want to get output like below?
var raw = Enumerable
.Range(1, 10)
.Select(i => Random.Shared.Next(-45, 46))
.ToArray(); // materializing is mandatory!

Console.WriteLine($"[{string.Join(", ", raw)}]");


var sorted = raw.OrderByDescending(i => i);
Console.WriteLine($"[{string.Join(", ", sorted)}]");

var secondMinimal = sorted.TakeLast(2).First();
Console.WriteLine($"The second minimal is {secondMinimal}.");
var raw = Enumerable
.Range(1, 10)
.Select(i => Random.Shared.Next(-45, 46))
.ToArray(); // materializing is mandatory!

Console.WriteLine($"[{string.Join(", ", raw)}]");


var sorted = raw.OrderByDescending(i => i);
Console.WriteLine($"[{string.Join(", ", sorted)}]");

var secondMinimal = sorted.TakeLast(2).First();
Console.WriteLine($"The second minimal is {secondMinimal}.");
No description
Pobiega
Pobiega5mo ago
Rude. Posting code when asked is standard and should not be countered with snide remarks. You also have not made it clear exactly what you are trying to do or where your problem is.
i like chatgpt
i like chatgpt5mo ago
I believe she/he cannot speak English.