CodeWars可以学习的

http://www.codewars.com/kata/54ff3102c1bad923760001f3/solutions/csharp

判断给定的字符串有多少个a e i o u

using System;
using System.Linq;

public static class Kata
{
    public static int GetVowelCount(string str)
    {
        return str.Count(x => "aeiou".IndexOf(x) != -1);
    }
}

 

public static class Kata
{
    public static int GetVowelCount(string str)
    {
       return str.Where(c => new [] {'a','e','i','o','u'}.Any(v => v == c)).Count();
    }
}

 

 

http://www.codewars.com/kata/5506b230a11c0aeab3000c1f

 

using System;

public class Evaporator { 
  
  public static int evaporator(double content, double evap_per_day, double threshold) {
    return (int)Math.Ceiling(Math.Log(threshold / 100.0) / Math.Log(1.0 - evap_per_day / 100.0));
  }
}

 

你可能感兴趣的:(code)