csharp基础练习题:我们已经起飞【难度:1级】--景越C#经典编程题库,不同难度C#练习题,适合自学C#的新手进阶训练

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_45444821/article/details/102716798

csharp基础练习题:我们已经起飞【难度:1级】:

你有数字1至n的数组矩阵(其中1 <= N <= 10).该数组矩阵需要读取飞船发射倒计时的人正确格式化.

不幸的是,阅读倒计时的人只知道如何读的字符串.数组矩阵正确排序后确认这是在他可以理解的格式.

之间的每个数字应该有一个空格,最后数(n)应该是这个词后"起飞!"

例:

# 鉴于
指令= [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剥离!"

编程目标:

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


测试样例:

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")]


最佳答案(多种解法):

点击查看答案

更多关联题目:

免责申明

本博客所有编程题目及答案均收集自互联网,主要用于供网友学习参考,如有侵犯你的权益请联系管理员及时删除,谢谢
题目收集至https://www.codewars.com/
https://www.codewars.com/kata/we-have-liftoff

猜你喜欢

转载自blog.csdn.net/weixin_45444821/article/details/102716798