csharp basic exercises: We have to take off [difficulty: Level 1] - view the C # programming classic exam, exercises of varying difficulty C #, C # novice suitable for self-study of advanced training

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_45444821/article/details/102716798

csharp basic exercises: We have to take off [difficulty: Level 1]:

You have an array of numbers 1 to n matrix (where 1 <= N <= 10). The array matrix needs to read spacecraft person countdown properly formatted.

Unfortunately, reading the countdown of people only know how to read the string after the matrix array sorted correctly confirmed this in his understandable format.

Each number should be a space between the last number (n) should be after the word "take off!"

Example:

# 鉴于
指令= [8,1,10,2,7,9,6,3,4,5]
# 应该返回
"10 9 8 7 6 5 4 3 2 1剥离!"

//鉴于
指令= [8,1,10,2,7,9,6,3,4,5]
//应该返回
"10 9 8 7 6 5 4 3 2 1剥离!"
//鉴于
指令= [1,2,4,3,5]
//应该返回
"5 4 3 2 1剥离!"

Kata.Liftoff(新列表的{2,8,10,9,1,3,4,7,6,5})=> "10 9 8 7 6 5 4 3 2 1剥离!"

Programming objectives:

using System;
using System.Collections.Generic;
public static class Kata
{
  public static string Liftoff(List instructions)
  {
    throw new NotImplementedException();
  }
}


Test sample:

namespace Solution 
{
  using NUnit.Framework;
  using System;
  using System.Collections.Generic;
  [TestFixture]
  public class SampleTest
  {
    {
      get
      {
        yield return new TestCaseData(new List {2, 8, 10, 9, 1, 3, 4, 7, 6, 5}).Returns("10 9 8 7 6 5 4 3 2 1 liftoff!");
      }
    }
    [Test, TestCaseSource("testCases")]


Best answer (multiple solutions):

Click to view answer

More related topics:

Disclaimer

This blog All programming topics and answers were collected from the Internet, users are mainly used for study and reference, if any violation of your rights, please contact the administrator to delete, thank
entitled to collect https://www.codewars.com/
HTTPS: / /www.codewars.com/kata/we-have-liftoff

Guess you like

Origin blog.csdn.net/weixin_45444821/article/details/102716798