You are on page 1of 84

Ejercicios:

1- Name Shuffler

using System.Linq;

public class Kata


{
public static string NameShuffler(string str)
{
return string .Join(' ', str.Split(' ').Reverse());
}
}
Ejecución:
Time: 2212ms Passed: 2 Failed: 0

Test Results:

 Solution
 SolutionTest
 Random Tests (100 assertions)
 Sample Tests
Completed in 30.0350ms
Completed in 34.9800ms
You have passed all of the tests! :)
2- NBA full 48 minutes’ average

using System;

public class Kata


{
public static double NbaExtrap(double ppg, double mpg)
{
return mpg == 0 ? 0 : Math.Round((ppg / mpg) * 48 ,1);

}
}
Ejecucion:
Tme: 2258ms Passed: 2 Failed: 0

Test Results:

 Solution
 Random_Test
 Random Tests
Completed in 19.8330ms
 Sample_Tests
 Test
Completed in 20.2100ms
Completed in 48.3760ms

You have passed all of the tests! :)


3- Vowel remover

using System.Text.RegularExpressions;

public class Kata


{
public static string Shortcut(string input)
{
return Regex.Replace(input, "[aeiou]", "");
}
}

Ejecucion:

Time: 2757ms Passed: 1 Failed: 0

Test Results:

 KataTest
 Test1
Completed in 31.1490ms

You have passed all of the tests! :)


4- Keep Hydrated!

using System;

public class Kata


{
public static int Litres(double time)
{

return (int)(time/2);
}
}
Ejecucion:
Time: 2367ms Passed: 107 Failed: 0

Test Results:
 Tests

 FixedTest

 FixedTest(2)

 FixedTest(1.4d)

 FixedTest(12.3d)

 FixedTest(0.82d)

 FixedTest(11.8d)

 FixedTest(1787)

 FixedTest(0)

Completed in 38.9320ms

 RandomTest

 RandomTest(7828)

 RandomTest(5336)

 RandomTest(5943)

 RandomTest(8054)
 RandomTest(4295)

 RandomTest(1045)

 RandomTest(241)

 RandomTest(4493)

 RandomTest(2282)

 RandomTest(4829)

 RandomTest(3685)

 RandomTest(5467)

 RandomTest(4046)

 RandomTest(7389)

 RandomTest(2516)

 RandomTest(9809)

 RandomTest(7769)

 RandomTest(2644)

 RandomTest(8227)

 RandomTest(3358)

 RandomTest(8741)

 RandomTest(9556)

 RandomTest(2417)

 RandomTest(7794)

 RandomTest(4446)

 RandomTest(9352)

 RandomTest(247)

 RandomTest(86)

 RandomTest(9162)

 RandomTest(4627)

 RandomTest(132)

 RandomTest(3270)

 RandomTest(1580)
 RandomTest(6)

 RandomTest(4744)

 RandomTest(82)

 RandomTest(1667)

 RandomTest(8644)

 RandomTest(4406)

 RandomTest(5191)

 RandomTest(6414)

 RandomTest(6452)

 RandomTest(2521)

 RandomTest(1384)

 RandomTest(6815)

 RandomTest(7586)

 RandomTest(34)

 RandomTest(181)

 RandomTest(7344)

 RandomTest(790)

 RandomTest(5951)

 RandomTest(755)

 RandomTest(7571)

 RandomTest(7744)

 RandomTest(3966)

 RandomTest(8271)

 RandomTest(2919)

 RandomTest(8149)

 RandomTest(3608)

 RandomTest(4942)

 RandomTest(798)

 RandomTest(154)
 RandomTest(5331)

 RandomTest(7655)

 RandomTest(4697)

 RandomTest(414)

 RandomTest(3886)

 RandomTest(4039)

 RandomTest(2645)

 RandomTest(2434)

 RandomTest(8142)

 RandomTest(9124)

 RandomTest(8237)

 RandomTest(3035)

 RandomTest(6943)

 RandomTest(2288)

 RandomTest(7035)

 RandomTest(1033)

 RandomTest(978)

 RandomTest(6859)

 RandomTest(9317)

 RandomTest(66)

 RandomTest(2742)

 RandomTest(8371)

 RandomTest(8676)

 RandomTest(9376)

 RandomTest(5699)

 RandomTest(3836)

 RandomTest(6040)

 RandomTest(6472)

 RandomTest(7162)
 RandomTest(3517)

 RandomTest(5036)

 RandomTest(9463)

 RandomTest(4393)

 RandomTest(6259)

 RandomTest(1121)

 RandomTest(4866)

 RandomTest(6687)

 RandomTest(6400)

Completed in 8.4860ms

Completed in 55.4420ms

You have passed all of the tests! :)


5- Array plus array

using System.Linq;

public static class Kata


{
public static int ArrayPlusArray(int[] arr1, int[] arr2)
{
return arr1.Sum()+arr2.Sum();
}
}

Ejecucion:

Time: 2062ms Passed: 2 Failed: 0

Test Results:

 Solution

 SolutionTest

 BasicTest

 RandomTest

Completed in 43.9780ms

Completed in 49.1640ms

You have passed all of the tests! :)


6- Color Ghost

using System;

public class Ghost


{
private readonly string[] Colors = {"white", "yellow", "purple", "red"};
public string GetColor() { return Colors[new Random().Next(0, 4)]; }

}
Ejecucion:

Time: 2382ms Passed: 4 Failed: 0

Test Results:

 GhostTests

 ShouldSometimesMakePurpleGhosts

 ShouldSometimesMakeRedGhosts

 ShouldSometimesMakeWhiteGhosts

 ShouldSometimesMakeYellowGhosts

Completed in 69.6240ms

You have passed all of the tests! :)


7- DNA to RNA Conversion

namespace Converter {
public class Converter
{
public string dnaToRna(string dna)
{
for(int i = 0; i < dna.Length; i++)
if(dna[i] == 'T')
dna = dna.Replace("T" , "U");
return dna;
}
}
}
Ejecucion:
Time: 2210ms Passed: 7 Failed: 0

Test Results:

 Converter

 Test

 testDna2

 testDna3

 testDna4

 testDna5

 testDna6

 testDna7

 testDna8

Completed in 34.5560ms

Completed in 40.4570ms
You have passed all of the tests! :)
8- Object Oriented Piracy

public class Ship


{
public int Draft;
public int Crew;

public Ship(int draft, int crew)


{
Draft = draft;
Crew = crew;
}
public bool IsWorthIt() {
return (Draft - Crew*1.5) > 20;
}
}
Ejecucion:
Time: 2013ms Passed: 6 Failed: 0

Test Results:

 Solution

 A_Large_Fleet_Of_Random_Ships

 Random Tests

Completed in 36.9140ms

 A_Small_Grouping_Of_Fixed_Ships

 Test

 Test([0, 0])

 Test([15, 20])

 Test([35, 20])

 Test([55, 20])
Completed in 1.2260ms

Completed in 1.3930ms

 Sample_Test

 SampleTest

Completed in 0.4660ms

Completed in 46.6330ms
You have passed all of the tests! :)
9- Hex to Decimal

using System;

public class Kata


{
public static int HexToDec(string hexString)
{
return Convert.ToInt32(hexString.TrimStart('-'), 16) * (hexString[0] == '-' ? -1 : 1);
}
}
Ejecucion:
Time: 2400ms Passed: 2 Failed: 0

Test Results:

 Solution

 KataTests

 BasicTests

 RandomTests

Completed in 43.1070ms

Completed in 48.2250ms

You have passed all of the tests! :)


10-validate code with simple regex

using System;
using System.Text.RegularExpressions;

public class Kata


{
public static bool ValidateCode(string code)
{
return Regex.IsMatch(code, "^[1-3]");
}
}
Ejecucion:
Time: 2255ms Passed: 105 Failed: 0

Test Results:
 Tests
 FixedTest
 FixedTest("123")
 FixedTest("248")
 FixedTest("8")
 FixedTest("321")
 FixedTest("9453")
Completed in 38.3440ms
 RandomTest
 RandomTest(12)
 RandomTest(9)
 RandomTest(4)
 RandomTest(6)
 RandomTest(1)
 RandomTest(11)
 RandomTest(9)
 RandomTest(5)
 RandomTest(17)
 RandomTest(16)
 RandomTest(13)
 RandomTest(10)
 RandomTest(3)
 RandomTest(15)
 RandomTest(14)
 RandomTest(0)
 RandomTest(3)
 RandomTest(5)
 RandomTest(13)
 RandomTest(6)
 RandomTest(19)
 RandomTest(11)
 RandomTest(7)
 RandomTest(7)
 RandomTest(7)
 RandomTest(1)
 RandomTest(16)
 RandomTest(6)
 RandomTest(4)
 RandomTest(9)
 RandomTest(14)
 RandomTest(13)
 RandomTest(1)
 RandomTest(17)
 RandomTest(6)
 RandomTest(1)
 RandomTest(16)
 RandomTest(16)
 RandomTest(3)
 RandomTest(10)
 RandomTest(9)
 RandomTest(9)
 RandomTest(17)
 RandomTest(19)
 RandomTest(16)
 RandomTest(10)
 RandomTest(8)
 RandomTest(8)
 RandomTest(16)
 RandomTest(18)
 RandomTest(19)
 RandomTest(8)
 RandomTest(9)
 RandomTest(11)
 RandomTest(8)
 RandomTest(0)
 RandomTest(2)
 RandomTest(16)
 RandomTest(18)
 RandomTest(0)
 RandomTest(14)
 RandomTest(2)
 RandomTest(0)
 RandomTest(8)
 RandomTest(1)
 RandomTest(0)
 RandomTest(9)
 RandomTest(5)
 RandomTest(9)
 RandomTest(13)
 RandomTest(3)
 RandomTest(7)
 RandomTest(2)
 RandomTest(2)
 RandomTest(17)
 RandomTest(10)
 RandomTest(13)
 RandomTest(7)
 RandomTest(11)
 RandomTest(17)
 RandomTest(12)
 RandomTest(7)
 RandomTest(10)
 RandomTest(5)
 RandomTest(9)
 RandomTest(6)
 RandomTest(4)
 RandomTest(9)
 RandomTest(9)
 RandomTest(5)
 RandomTest(19)
 RandomTest(0)
 RandomTest(17)
 RandomTest(2)
 RandomTest(16)
 RandomTest(6)
 RandomTest(8)
 RandomTest(9)
 RandomTest(17)
 RandomTest(16)
Completed in 7.1460ms
Completed in 52.6390ms
You have passed all of the tests! :)
11-The 'if' function

using System;

public class Kata


{
public static void If(bool condition, Action func1, Action func2)
{
(condition ? func1 : func2)();

}
}
Ejecucion:
Time: 2171ms Passed: 2 Failed: 0

Test Results:

 Tests

 FalseTest

 TrueTest

Completed in 22.3000ms

You have passed all of the tests! :)


12- Convert to Binary

using System;

public static class Kata


{
public static int ToBinary(int n)
{
return Convert.ToInt32(Convert.ToString(n,2));

}
}
Ejecucion:
Time: 1970ms Passed: 260 Failed: 0

Test Results:
 Solution
 BasicTests
 Test
 Arguments: (n: 1)
 Arguments: (n: 2)
 Arguments: (n: 3)
 Arguments: (n: 5)
Completed in 26.5290ms
Completed in 32.0180ms
 RandomTests
 Test
 Arguments: (n: 212)
 Arguments: (n: 188)
 Arguments: (n: 128)
 Arguments: (n: 215)
 Arguments: (n: 98)
 Arguments: (n: 19)
 Arguments: (n: 99)
 Arguments: (n: 80)
 Arguments: (n: 69)
 Arguments: (n: 211)
 Arguments: (n: 36)
 Arguments: (n: 137)
 Arguments: (n: 35)
 Arguments: (n: 4)
 Arguments: (n: 58)
 Arguments: (n: 88)
 Arguments: (n: 64)
 Arguments: (n: 81)
 Arguments: (n: 197)
 Arguments: (n: 111)
 Arguments: (n: 236)
 Arguments: (n: 43)
 Arguments: (n: 97)
 Arguments: (n: 112)
 Arguments: (n: 218)
 Arguments: (n: 49)
 Arguments: (n: 54)
 Arguments: (n: 40)
 Arguments: (n: 192)
 Arguments: (n: 46)
 Arguments: (n: 224)
 Arguments: (n: 216)
 Arguments: (n: 168)
 Arguments: (n: 149)
 Arguments: (n: 14)
 Arguments: (n: 61)
 Arguments: (n: 79)
 Arguments: (n: 239)
 Arguments: (n: 238)
 Arguments: (n: 154)
 Arguments: (n: 189)
 Arguments: (n: 202)
 Arguments: (n: 133)
 Arguments: (n: 47)
 Arguments: (n: 118)
 Arguments: (n: 243)
 Arguments: (n: 110)
 Arguments: (n: 25)
 Arguments: (n: 33)
 Arguments: (n: 185)
 Arguments: (n: 233)
 Arguments: (n: 83)
 Arguments: (n: 78)
 Arguments: (n: 213)
 Arguments: (n: 136)
 Arguments: (n: 122)
 Arguments: (n: 13)
 Arguments: (n: 92)
 Arguments: (n: 244)
 Arguments: (n: 135)
 Arguments: (n: 66)
 Arguments: (n: 221)
 Arguments: (n: 10)
 Arguments: (n: 181)
 Arguments: (n: 26)
 Arguments: (n: 160)
 Arguments: (n: 150)
 Arguments: (n: 241)
 Arguments: (n: 32)
 Arguments: (n: 117)
 Arguments: (n: 57)
 Arguments: (n: 147)
 Arguments: (n: 67)
 Arguments: (n: 28)
 Arguments: (n: 37)
 Arguments: (n: 68)
 Arguments: (n: 70)
 Arguments: (n: 106)
 Arguments: (n: 38)
 Arguments: (n: 229)
 Arguments: (n: 39)
 Arguments: (n: 41)
 Arguments: (n: 132)
 Arguments: (n: 175)
 Arguments: (n: 100)
 Arguments: (n: 77)
 Arguments: (n: 65)
 Arguments: (n: 119)
 Arguments: (n: 15)
 Arguments: (n: 103)
 Arguments: (n: 44)
 Arguments: (n: 123)
 Arguments: (n: 127)
 Arguments: (n: 138)
 Arguments: (n: 253)
 Arguments: (n: 173)
 Arguments: (n: 170)
 Arguments: (n: 159)
 Arguments: (n: 93)
 Arguments: (n: 124)
 Arguments: (n: 248)
 Arguments: (n: 48)
 Arguments: (n: 56)
 Arguments: (n: 22)
 Arguments: (n: 82)
 Arguments: (n: 199)
 Arguments: (n: 165)
 Arguments: (n: 50)
 Arguments: (n: 86)
 Arguments: (n: 12)
 Arguments: (n: 62)
 Arguments: (n: 250)
 Arguments: (n: 11)
 Arguments: (n: 125)
 Arguments: (n: 109)
 Arguments: (n: 240)
 Arguments: (n: 126)
 Arguments: (n: 140)
 Arguments: (n: 245)
 Arguments: (n: 52)
 Arguments: (n: 23)
 Arguments: (n: 45)
 Arguments: (n: 148)
 Arguments: (n: 230)
 Arguments: (n: 84)
 Arguments: (n: 219)
 Arguments: (n: 115)
 Arguments: (n: 190)
 Arguments: (n: 195)
 Arguments: (n: 249)
 Arguments: (n: 178)
 Arguments: (n: 157)
 Arguments: (n: 220)
 Arguments: (n: 194)
 Arguments: (n: 205)
 Arguments: (n: 226)
 Arguments: (n: 187)
 Arguments: (n: 207)
 Arguments: (n: 8)
 Arguments: (n: 143)
 Arguments: (n: 141)
 Arguments: (n: 255)
 Arguments: (n: 0)
 Arguments: (n: 87)
 Arguments: (n: 21)
 Arguments: (n: 177)
 Arguments: (n: 151)
 Arguments: (n: 145)
 Arguments: (n: 214)
 Arguments: (n: 121)
 Arguments: (n: 60)
 Arguments: (n: 24)
 Arguments: (n: 75)
 Arguments: (n: 246)
 Arguments: (n: 191)
 Arguments: (n: 53)
 Arguments: (n: 156)
 Arguments: (n: 169)
 Arguments: (n: 94)
 Arguments: (n: 231)
 Arguments: (n: 73)
 Arguments: (n: 63)
 Arguments: (n: 171)
 Arguments: (n: 71)
 Arguments: (n: 90)
 Arguments: (n: 7)
 Arguments: (n: 155)
 Arguments: (n: 3)
 Arguments: (n: 206)
 Arguments: (n: 72)
 Arguments: (n: 184)
 Arguments: (n: 153)
 Arguments: (n: 242)
 Arguments: (n: 164)
 Arguments: (n: 232)
 Arguments: (n: 225)
 Arguments: (n: 146)
 Arguments: (n: 105)
 Arguments: (n: 30)
 Arguments: (n: 108)
 Arguments: (n: 116)
 Arguments: (n: 176)
 Arguments: (n: 180)
 Arguments: (n: 42)
 Arguments: (n: 2)
 Arguments: (n: 85)
 Arguments: (n: 131)
 Arguments: (n: 1)
 Arguments: (n: 27)
 Arguments: (n: 204)
 Arguments: (n: 179)
 Arguments: (n: 130)
 Arguments: (n: 201)
 Arguments: (n: 144)
 Arguments: (n: 228)
 Arguments: (n: 196)
 Arguments: (n: 9)
 Arguments: (n: 163)
 Arguments: (n: 166)
 Arguments: (n: 91)
 Arguments: (n: 139)
 Arguments: (n: 200)
 Arguments: (n: 162)
 Arguments: (n: 254)
 Arguments: (n: 107)
 Arguments: (n: 174)
 Arguments: (n: 104)
 Arguments: (n: 134)
 Arguments: (n: 182)
 Arguments: (n: 186)
 Arguments: (n: 76)
 Arguments: (n: 5)
 Arguments: (n: 101)
 Arguments: (n: 203)
 Arguments: (n: 209)
 Arguments: (n: 96)
 Arguments: (n: 114)
 Arguments: (n: 142)
 Arguments: (n: 251)
 Arguments: (n: 208)
 Arguments: (n: 120)
 Arguments: (n: 6)
 Arguments: (n: 102)
 Arguments: (n: 198)
 Arguments: (n: 183)
 Arguments: (n: 20)
 Arguments: (n: 59)
 Arguments: (n: 31)
 Arguments: (n: 247)
 Arguments: (n: 172)
 Arguments: (n: 217)
 Arguments: (n: 29)
 Arguments: (n: 74)
 Arguments: (n: 227)
 Arguments: (n: 34)
 Arguments: (n: 89)
 Arguments: (n: 152)
 Arguments: (n: 222)
 Arguments: (n: 161)
 Arguments: (n: 167)
 Arguments: (n: 113)
 Arguments: (n: 16)
 Arguments: (n: 210)
 Arguments: (n: 129)
 Arguments: (n: 18)
 Arguments: (n: 158)
 Arguments: (n: 234)
 Arguments: (n: 51)
 Arguments: (n: 17)
 Arguments: (n: 223)
 Arguments: (n: 235)
 Arguments: (n: 95)
 Arguments: (n: 237)
 Arguments: (n: 193)
 Arguments: (n: 252)
 Arguments: (n: 55)
Completed in 16.7500ms
Completed in 16.9120ms
Completed in 53.9670ms

You have passed all of the tests! :)


13-Is he gonna survive?

class Kata
{
public static bool Hero(int bullets, int dragons)
{
return bullets / 2 >= dragons;
}
}
Ejecucion:
Time: 1943ms Passed: 7 Failed: 0

Test Results:

 Tests
 AFalseHero
 AFalseHero(4,5)
 AFalseHero(1500,751)
 AFalseHero(0,1)
 AFalseHero(7,4)
Completed in 14.3680ms
 ATrueHero
 ATrueHero(10,5)
 ATrueHero(100,40)
Completed in 0.9140ms
 IsHeAHero
Completed in 39.5650ms

You have passed all of the tests! :)


14- Generate range of integers

using System.Linq;

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{

return Enumerable.Range(min, max - min + 1).Where(x => (x - min) % step == 0).ToArray();


}
}

Ejecucion:
Time: 2287ms Passed: 105 Failed: 0

Test Results:

 Tests

 FixedTest

 FixedTest(2,10,2)

 FixedTest(1,10,3)

 FixedTest(1,10,1)

 FixedTest(1,10,4)

 FixedTest(1,10,5)

Completed in 38.0930ms

 RandomTest

 RandomTest(8)

 RandomTest(9)

 RandomTest(9)

 RandomTest(3)

 RandomTest(6)

 RandomTest(7)
 RandomTest(6)

 RandomTest(8)

 RandomTest(4)

 RandomTest(6)

 RandomTest(4)

 RandomTest(8)

 RandomTest(6)

 RandomTest(8)

 RandomTest(7)

 RandomTest(8)

 RandomTest(7)

 RandomTest(2)

 RandomTest(2)

 RandomTest(9)

 RandomTest(1)

 RandomTest(4)

 RandomTest(6)

 RandomTest(8)

 RandomTest(5)

 RandomTest(5)

 RandomTest(4)

 RandomTest(9)

 RandomTest(9)

 RandomTest(9)

 RandomTest(7)

 RandomTest(3)

 RandomTest(9)

 RandomTest(5)

 RandomTest(7)
 RandomTest(1)

 RandomTest(7)

 RandomTest(4)

 RandomTest(5)

 RandomTest(2)

 RandomTest(6)

 RandomTest(1)

 RandomTest(8)

 RandomTest(3)

 RandomTest(1)

 RandomTest(3)

 RandomTest(2)

 RandomTest(1)

 RandomTest(6)

 RandomTest(4)

 RandomTest(4)

 RandomTest(3)

 RandomTest(5)

 RandomTest(5)

 RandomTest(6)

 RandomTest(5)

 RandomTest(3)

 RandomTest(2)

 RandomTest(8)

 RandomTest(1)

 RandomTest(3)

 RandomTest(6)

 RandomTest(8)

 RandomTest(5)
 RandomTest(9)

 RandomTest(2)

 RandomTest(8)

 RandomTest(2)

 RandomTest(1)

 RandomTest(6)

 RandomTest(2)

 RandomTest(4)

 RandomTest(6)

 RandomTest(1)

 RandomTest(4)

 RandomTest(1)

 RandomTest(5)

 RandomTest(4)

 RandomTest(8)

 RandomTest(2)

 RandomTest(4)

 RandomTest(4)

 RandomTest(3)

 RandomTest(5)

 RandomTest(6)

 RandomTest(4)

 RandomTest(8)

 RandomTest(4)

 RandomTest(9)

 RandomTest(2)

 RandomTest(8)

 RandomTest(6)

 RandomTest(5)
 RandomTest(5)

 RandomTest(9)

 RandomTest(9)

 RandomTest(2)

 RandomTest(3)

 RandomTest(3)

 RandomTest(9)

Completed in 9.0920ms

Completed in 54.1110ms

You have passed all of the tests! :)


15-Expressions Matter

using System;
using System.Linq;
public class Kata
{
public static int ExpressionsMatter(int a, int b, int c)
{
int[] res =
{
a*b*c,
a*b+c,
a*(b+c),
(a+b)*c,
a+b*c,
a+b+c,
};
return res.Max();
}
}
Ejecucion:
Time: 2287ms Passed: 20 Failed: 0

Test Results:

 Solution

 ExpressionsMatter

 CheckIntermediateValues

 CheckIntermediateValues(20,5,1,3)

 CheckIntermediateValues(105,3,5,7)

 CheckIntermediateValues(35,5,6,1)
 CheckIntermediateValues(8,1,6,1)

 CheckIntermediateValues(14,2,6,1)

 CheckIntermediateValues(48,6,7,1)

Completed in 36.4520ms

 CheckMixedValues

 CheckMixedValues(60,2,10,3)

 CheckMixedValues(27,1,8,3)

 CheckMixedValues(126,9,7,2)

 CheckMixedValues(20,1,1,10)

 CheckMixedValues(18,9,1,1)

 CheckMixedValues(300,10,5,6)

 CheckMixedValues(12,1,10,1)

Completed in 2.2130ms

 CheckSmallValues

 CheckSmallValues(6,2,1,2)

 CheckSmallValues(3,1,1,1)

 CheckSmallValues(4,2,1,1)

 CheckSmallValues(9,1,2,3)

 CheckSmallValues(5,1,3,1)

 CheckSmallValues(8,2,2,2)

Completed in 1.7180ms

 RandomTests

Completed in 48.3530ms

Completed in 51.6760ms

You have passed all of the tests! :)


16- Regular Ball Super Ball

using System;

public class Ball {

public string ballType { get; set; }

public Ball(string ballType = "regular") {

this.ballType = ballType;

Ejecucion:

Time: 1878ms Passed: 2 Failed: 0

Test Results:

 FactorialTests

 ConstructorWithArgumentShouldSetBallTypeAsExpected

 DefaultConstructorShouldSetBallTypeToRegular

Completed in 23.4490ms

You have passed all of the tests! :)


17-Swap Values

public class Swapper


{
public object[] Arguments { get; private set; }

public Swapper(object[] args)


{
Arguments = args;
}

public void SwapValues()


{
System.Array.Reverse(Arguments);
}
}
Ejecucion:
Time: 2369ms Passed: 4 Failed: 0

Test Results:

 Solution

 Tests

 ArraysTest

 DifferentSubtypesTest

 ExampleTest

 StringTest

Completed in 40.2520ms

Completed in 45.3590ms

You have passed all of the tests! :)


18-What is between?

using System;

using System.Linq;

public static class Kata

public static int[] Between(int a, int b)

return Enumerable.Range(a, b - a + 1).ToArray();

Ejecucion:

Time: 2413ms Passed: 3 Failed: 0

Test Results:

 KataTest

 Test1

 Test2

 Test3

Completed in 41.5950ms

You have passed all of the tests! :)


19-Playing with cubes I

using System;

public class Cube


{

private int side = 0;

public int GetSide() { return side; }

public void SetSide(int num) { side = num; }

}
Ejecucion:
Time: 2296ms Passed: 2 Failed: 0

Test Results:

 Test
 FixedTest
 RandomTest
Completed in 43.8790ms

You have passed all of the tests! :)


20-Drink about

public class Kata


{
public static string PeopleWithAgeDrink(int old)
{

return "drink " + (old < 14 ? "toddy" : old < 18 ? "coke" : old < 21 ? "beer" :
"whisky");

}
}
Ejecucion:
Time: 2319ms Passed: 107 Failed: 0

Test Results:

 Tests

 FixedTest

 FixedTest(22)

 FixedTest(0)

 FixedTest(13)

 FixedTest(14)

 FixedTest(15)

 FixedTest(20)

 FixedTest(21)

Completed in 30.9250ms

 RandomTest

 RandomTest(4)

 RandomTest(9)
 RandomTest(18)

 RandomTest(19)

 RandomTest(7)

 RandomTest(15)

 RandomTest(3)

 RandomTest(24)

 RandomTest(19)

 RandomTest(21)

 RandomTest(24)

 RandomTest(15)

 RandomTest(3)

 RandomTest(6)

 RandomTest(28)

 RandomTest(3)

 RandomTest(18)

 RandomTest(28)

 RandomTest(13)

 RandomTest(23)

 RandomTest(15)

 RandomTest(14)

 RandomTest(26)

 RandomTest(28)

 RandomTest(13)

 RandomTest(2)

 RandomTest(25)

 RandomTest(3)

 RandomTest(21)

 RandomTest(20)

 RandomTest(16)
 RandomTest(4)

 RandomTest(17)

 RandomTest(23)

 RandomTest(8)

 RandomTest(9)

 RandomTest(8)

 RandomTest(3)

 RandomTest(3)

 RandomTest(17)

 RandomTest(7)

 RandomTest(5)

 RandomTest(10)

 RandomTest(14)

 RandomTest(24)

 RandomTest(13)

 RandomTest(7)

 RandomTest(19)

 RandomTest(11)

 RandomTest(24)

 RandomTest(18)

 RandomTest(17)

 RandomTest(0)

 RandomTest(11)

 RandomTest(6)

 RandomTest(19)

 RandomTest(12)

 RandomTest(20)

 RandomTest(5)

 RandomTest(5)
 RandomTest(19)

 RandomTest(0)

 RandomTest(2)

 RandomTest(28)

 RandomTest(5)

 RandomTest(19)

 RandomTest(28)

 RandomTest(10)

 RandomTest(27)

 RandomTest(19)

 RandomTest(24)

 RandomTest(15)

 RandomTest(25)

 RandomTest(26)

 RandomTest(16)

 RandomTest(10)

 RandomTest(3)

 RandomTest(12)

 RandomTest(3)

 RandomTest(0)

 RandomTest(24)

 RandomTest(6)

 RandomTest(21)

 RandomTest(26)

 RandomTest(1)

 RandomTest(29)

 RandomTest(4)

 RandomTest(6)

 RandomTest(17)
 RandomTest(18)

 RandomTest(26)

 RandomTest(18)

 RandomTest(27)

 RandomTest(27)

 RandomTest(28)

 RandomTest(7)

 RandomTest(2)

 RandomTest(12)

 RandomTest(8)

 RandomTest(5)

Completed in 6.7090ms

Completed in 45.7980ms

You have passed all of the tests! :)


21-Super Duper Easy

using System;

public class Kata


{
public static string Problem(String Input)
{
Double value;
return (Double.TryParse(Input, out value)) ? (value * 50 + 6).ToString() :
"Error";
}
}
Ejecucion:

Time: 1943ms Passed: 2 Failed: 0

Test Results:

 EasyTests

 Randoms

 Test1

Completed in 26.8940ms

You have passed all of the tests! :)


22-Compare within margin

public class Kata


{

public static int CloseCompare(double a, double b, double margin = 0)


{
if(a + margin < b) return -1;
else if(a > b + margin) return 1;

return 0;
}
}
Ejecucion:
Time: 2311ms Passed: 3 Failed: 0

Test Results:

 Solution

 KataTests

 MarginOf3Tests

 NoMarginTests

 RandomTests

Completed in 42.0410ms

Completed in 47.1030ms

You have passed all of the tests! :)

23-Is this my tail?


using System.Linq;

public class Kata

public static bool CorrectTail(string body, string tail)

return body.Last() == tail.FirstOrDefault();

Ejecucion:
Time: 1917ms Passed: 7 Failed: 0

Test Results:

 Solution

 Random_Test

 Random Tests

Completed in 38.7190ms

 Sample_Test

 Test

 Test("Fox","x")

 Test("Rhino","o")

 Test("Meerkat","t")

 Test("Emu","t")

 Test("Badger","s")

 Test("Giraffe","d")

Completed in 1.0050ms

Completed in 1.1630ms

Completed in 46.8960ms
You have passed all of the tests! :)

24- Is it a number
using System;
public class CodeWars
{
public static bool IsDigit(string s)
{
float number;
return Single.TryParse(s, out number);
}
}
Ejecucion:
Time: 2398ms Passed: 13 Failed: 0

Test Results:
 Solution
 SolutionTest
 BasicTests
 BasicTests("s2324",False)
 BasicTests("3 4",False)
 BasicTests("3-4",False)
 BasicTests("3 4 ",False)
 BasicTests("34.65",True)
 BasicTests("-0",True)
 BasicTests(" ",False)
 BasicTests("",False)
 BasicTests("0.0",True)
 BasicTests("ab",False)
 BasicTests("ab cd",False)
 BasicTests(null,False)
Completed in 18.9490ms
 RandomTest
Completed in 27.7030ms
Completed in 31.2340ms
You have passed all of the tests! :)

25-Area of a Square
using System;
public class Kata
{
public static double SquareArea(double A)
{
return Math.Round(Math.Pow(4*A/(2*Math.PI),2),2);
}
}
Ejecucion:
Time: 1927ms Passed: 4 Failed: 0

Test Results:

 Solution

 Random_Tests

 Random Tests

Completed in 32.2380ms

 Sample_Tests

 SampleTest

 SampleTest(2.0d,1.62d)

 SampleTest(0.0d,0.0d)

 SampleTest(14.05d,80.0d)

Completed in 1.0160ms

Completed in 1.1950ms

Completed in 40.3590ms
You have passed all of the tests! :)

26- Will you make it?


using System;

public static class Kata

public static bool ZeroFuel(uint distanceToPump, uint mpg, uint fuelLeft)

return mpg * fuelLeft >= distanceToPump;

}
Ejecucion:
Time: 2344ms Passed: 3 Failed: 0

Test Results:

 Solution

 SolutionTest

 BasicTest

 RandomTest

 SampleTest

Completed in 46.4060ms

Completed in 51.6600ms

You have passed all of the tests! :)

27-A + B
public class FirstClass

public static byte sum (byte d, byte f)

byte r = (byte) (d + f);

return r;

Ejecucion:
Time: 2250ms Passed: 2 Failed: 0

Test Results:

 Solution
 FirstClassTest
 testRandomSum
 testSum
Completed in 42.2210ms
Completed in 48.0320ms

You have passed all of the tests! :)

28-Number toString
public class Kata
{

static int num=123;


public static string A = 123.ToString();
}
Ejecuacion:
Time: 1977ms Passed: 1 Failed: 0

Test Results:
 Log
src/Solution.cs(4,13): warning CS0414: The field 'Kata.num' is assigned but its value is never
used
 Solution
 SolutionTest
 Test
Completed in 24.7020ms
Completed in 28.8500ms

You have passed all of the tests! :)

You might also like