Advertisement
Layvu

LQ1

Mar 20th, 2023
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace ClassWork
  5. {
  6.     internal class Program
  7.     {
  8.         public static void Main(string[] args)
  9.         {
  10.             var numbs = new[]{ 1, 2, 3, 4 };
  11.             var numbsFinal = Function(numbs, 3);
  12.  
  13.             foreach (var numb in numbsFinal) Console.WriteLine(numb);
  14.         }
  15.  
  16.         public static T[] Function<T>(T[] values, int k)
  17.         {
  18.             return values
  19.                 .Skip(k)
  20.                 .Concat(values.Take(k))
  21.                 .ToArray();
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement