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));
  }
}

 

posted @ 2015-07-03 20:56  ChuckLu  阅读(430)  评论(0编辑  收藏  举报