0% found this document useful (0 votes)
513 views90 pages

C# Programming Language - Set of Tasks (20) and Solutions

Here are the key steps to solve this problem: 1. You are given an array representing a meerkat with its head, body, and tail in the wrong order. 2. The goal is to rearrange the array so the elements are in the correct order of head, body, tail. 3. To do this, use a temporary variable to swap the first and last elements of the array, representing switching the head and tail. 4. Return the rearranged array. For example: ``` // Given array int[] meerkat = [tail, body, head]; // Swap first and last elements int temp = meerkat[0];

Uploaded by

suri orao
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
513 views90 pages

C# Programming Language - Set of Tasks (20) and Solutions

Here are the key steps to solve this problem: 1. You are given an array representing a meerkat with its head, body, and tail in the wrong order. 2. The goal is to rearrange the array so the elements are in the correct order of head, body, tail. 3. To do this, use a temporary variable to swap the first and last elements of the array, representing switching the head and tail. 4. Return the rearranged array. For example: ``` // Given array int[] meerkat = [tail, body, head]; // Swap first and last elements int temp = meerkat[0];

Uploaded by

suri orao
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 90

Programming Tasks

CodeWars

Online Course 2/12/21 Programming language C#


Izbornik

Zad2: The
Zad1: Array Maximum Zad3: Average Zad4: A Hero
Number

Zad7:
Zad5: Zoo Zad6: Big City Zad8: Cube
Uppercase

Zad10: Even or Zad11: Sum of Zad12: Basic


Zad9: Between
Odd Positive Regex

Zad15:
Zad13: Circular Zad14: Zad16: Shark
Generate
arcA Championship Pontoon
Range

Zad19:
Zad17: Set of Zad18: Pole Zad20: Take an
Filtering Even
First Elements Vault Arrow
Numbers

Kazalo
pojmova
ZADATAK 1/20 - ARRAY

This kata is from check py.checkio.org

You are given an array with positive numbers and a non-negative number N.
You should find the N-th power of the element in the array with the index
N. If N is outside of the array, then return -1. Don't forget
that the first element has the index 0. Izbornik

Let's look at a few examples:

array = [1, 2, 3, 4] and N = 2, then the result is 3^2 == 9;

array = [1, 2, 3] and N = 3, but N is outside of the array, so the result


is -1.

SOLUTION 1 OF 1 – ZAD 1

using System;
public class Kata
{
public static double Index(int[] array, int n)
=> n < array.Length ? Math.Pow(array[n],n) : -1;
}

Page 1 of 89
ZADATAK 2/20 - THE MAXIMUM NUMBER
Given a number , Return _The Maximum number _ could be formed from the digits of
the number given .

Notes
Izbornik
Only Natural numbers passed to the function , numbers Contain digits
[0:9] inclusive

Digit Duplications could occur , So also consider it when forming the Largest

Input >> Output Examples:


maxNumber (213) ==> return (321)

Explanation:
As 321 is _The Maximum number _ could be formed from the digits of the number 213
.

As 9873 is _The Maximum number _ could be formed from the digits of the number
7389 .

As 97632 is _The Maximum number _ could be formed from the digits of the number
63729 .

SOLUTION 1 OF 4 – ZAD 2
using System.Linq;

class Kata
{
public static int MaxNumber(int n) =>
int.Parse($"{n}".OrderByDescending(c => c).ToArray());
}

SOLUTION 2 OF 4 – ZAD 2
using System.Linq;

class Kata
{
public static int MaxNumber(int n)
{
return int.Parse(string.Concat(n.ToString().OrderByDescending(x =>
char.GetNumericValue(x))));
}
}

Page 2 of 89
SOLUTION 3 OF 4 – ZAD 2
using System;
using System.Linq;
using System.Collections.Generic;

class Kata
{
public static int MaxNumber(int n) =>
int.Parse(
n.ToString()
.Select(x => x)
.OrderByDescending(x => x)
.Select(x => x.ToString())
.StringJoin("")
);
}

public static class StringExtensions{


public static String StringJoin(this IEnumerable<String> source, string
delim ) => String.Join(delim, source);
}

SOLUTION 4 OF 4 – ZAD 2
using System;
class Kata
{
public static int MaxNumber(int n)
{
char[] arr=n.ToString().ToCharArray();
Array.Sort(arr);
Array.Reverse(arr);

return int.Parse(new string(arr));


}
}

Page 3 of 89
ZADATAK 3/20 - AVERAGE

It's the academic year's end, fateful moment of your school report.
The averages must be calculated. All the students come to you and
Izbornik
entreat you to calculate their average for them. Easy ! You just
need to write a script.

Return the average of the given array rounded down to its nearest integer.

The array will never be empty.

SOLUTION 1 OF 7 – ZAD 3
using System.Linq;
using System.Collections.Generic;
using System;

public class Kata


{
public static int GetAverage(int[] marks)
{
return (int)marks.Average();
}
}
SOLUTION 2 OF 7 – ZAD 3
using System.Linq;
using System.Collections.Generic;
using System;

public class Kata


{
public static int GetAverage(int[] marks)
{
return marks.Sum()/marks.Length;
}
}
SOLUTION 3 OF 7 – ZAD 3
using System.Linq;
using System.Collections.Generic;
using System;

public class Kata


{
public static int GetAverage(int[] x) => (int)x.Average();
}
SOLUTION 4 OF 7 – ZAD 3
using System.Linq;
using System.Collections.Generic;
using System;

Page 4 of 89
public class Kata
{
public static int GetAverage(int[] marks)
{
long marksSum = 0;
foreach(int mark in marks)
{
marksSum += mark;
}
long result = marksSum / (long)marks.Length;

return (int)result;
}
}
SOLUTION 5 OF 7 – ZAD 3
using System.Linq;
using System.Collections.Generic;
using System;

public class Kata


{
public static int GetAverage(int[] marks)
{
var result = 0;

foreach (var val in marks)


{
result += val;
}

return result / marks.Length;


}
}
SOLUTION 6 OF 7 – ZAD 3
using System.Linq;
using System.Collections.Generic;
using System;

public class Kata


{
public static int GetAverage(int[] marks)
{
double now = marks.Average();
int then = (int)Math.Floor(now);
return then;

}
}

Page 5 of 89
SOLUTION 7 OF 7 – ZAD 3
using System.Linq;
using System.Collections.Generic;
using System;

public class Kata


{
public static int GetAverage(int[] marks)
{
int count=0;
int sum=0;
foreach(var num in marks)
{
sum = num+sum;
count++;
}
return sum/count;
}
}

Page 6 of 89
ZADATAK 4/20 - A HERO

A hero is on his way to the castle to complete his mission. However, he's
been told that the castle is surrounded with a couple of powerful dragons!
each dragon takes 2 bullets to be defeated, our hero has no idea how many
bullets he should carry.. Assuming he's gonna grab a specific given number
of bullets and move forward to fight another specific given
number of dragons, will he survive? Izbornik

Return True if yes, False otherwise :)

SOLUTION 1 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons)
{
return bullets / 2 >= dragons;
}
}
SOLUTION 2 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons)
{
return bullets>=dragons*2;
}
}

Page 7 of 89
SOLUTION 3 OF 12 – ZAD 4
class Kata

public static bool Hero(int bullets, int dragons) => dragons * 2 <=
bullets;

SOLUTION 4 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons)
{
return dragons*2 <= bullets;
}
}
SOLUTION 5 OF 12 – ZAD 4

using System;

class Kata
{
public static bool Hero(int bullets, int dragons) => new Func<int, int,
bool>((b, d) => {
bool result = default;
for (var k = 0; k <= 2; ++k)
{
result = d * k <= b ? true : false;
}
return result;
})(bullets, dragons);
}
SOLUTION 6 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons)
{
if ((dragons - (bullets/2)) <= 0) return true;
return false;
}

Page 8 of 89
}
SOLUTION 7 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons) => bullets / dragons
>= 2;

}
SOLUTION 8 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons)
{
return bullets >= 2 * dragons ? true : false;
}
}

Page 9 of 89
SOLUTION 9 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons)
{
//Do Some Magic...
if (bullets >= (dragons*2)){
return true;
}
else{
return false;
}
}
}
SOLUTION 10 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons)
{
if(bullets/2 >= dragons)
return true;
else
return false;
}
}

Page 10 of 89
SOLUTION 11 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons)
{
return bullets >= dragons << 1;
}
}
SOLUTION 12 OF 12 – ZAD 4

class Kata
{
public static bool Hero(int bullets, int dragons) => bullets >= dragons*2
? true: false;
}

Page 11 of 89
ZADATAK 5/20 - ZOO

You're at the zoo... all the meerkats look weird. Something has gone terribly
wrong - someone has gone and switched their heads and tails around!

Save the animals by switching them back. You will be given an


array which will have three values (tail, body, head). It is Izbornik
your job to re-arrange the array so that the animal is the right
way round (head, body, tail).

Same goes for all the other arrays/lists that you will get in the tests: you
have to change the element positions with the same exact logics

Simples!
SOLUTION 1 OF 12 – ZAD 5

using System.Linq;

public class Kata {

public static string[] FixTheMeerkat(string[] arr)

=> arr.Reverse().ToArray();

SOLUTION 2 OF 12 – ZAD 5

using System;
public class Kata
{
public static string[] FixTheMeerkat(string[] a)
{
Array.Reverse(a);
return a;
}
}

Page 12 of 89
SOLUTION 3 OF 12 – ZAD 5

public class Kata


{
public static string[] FixTheMeerkat(string[] arr)
{
var temp = arr[0];

arr[0] = arr[2]; //голова


arr[1] = arr[1]; //тело
arr[2] = temp; //хвост

return arr;
}
}
SOLUTION 4 OF 12 – ZAD 5

using System;
using System.Linq;
public class Kata
{
public static string[] FixTheMeerkat(string[] arr) =>
arr.Reverse().ToArray();
}

Page 13 of 89
SOLUTION 5 OF 12 – ZAD 5

using System.Linq;

public class Kata


{
public static string[] FixTheMeerkat(string[] arr)
{
return arr.Reverse().ToArray();
}
}
SOLUTION 6 OF 12 – ZAD 5

using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static string[] FixTheMeerkat(string[] arr)
{
// "хвост", "тело", "голова"

var temp = arr[0];


arr[0] = arr[2];
arr[2] = temp;

return arr;
}
}

Page 14 of 89
SOLUTION 7 OF 12 – ZAD 5

using System;
public class Kata
{
public static String[] FixTheMeerkat(String[] arr)
{
String temp = String.Empty;
for (Int32 i = arr.Length - 1, j = 0; i > j; i--, j++)
{
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}

return arr;
}
}
SOLUTION 8 OF 12 – ZAD 5

public class Kata


{
public static string[] FixTheMeerkat(string[] pTestArray)
{
//Make a copy of the array
string[] fTemp = ( string[] ) pTestArray.Clone();

//first value to last value


fTemp[ 0 ] = pTestArray[ pTestArray.Length - 1 ];

//last value to first value


fTemp[ pTestArray.Length - 1 ] = pTestArray[ 0 ];

//Return the temp array with the values in question.


return fTemp;
}
}
SOLUTION 9 OF 12 – ZAD 5

public class Kata


{

Page 15 of 89
public static string[] FixTheMeerkat(string[] arr)
{
(arr[0], arr[2]) = (arr[2], arr[0]);
return arr;
}
}
SOLUTION 10 OF 12 – ZAD 5

public class Kata


{
public static string[] FixTheMeerkat(string[] arr)
{

string[] result = new string[3];

int j = 0;

for(int i = arr.Length - 1; i >= 0; i--)


{
result[j] = arr[i];
j++;
}
return result;
}
}
SOLUTION 11 OF 12 – ZAD 5

public class Kata


{
public static string[] FixTheMeerkat(string[] arr)
{
string buffor;
int x = arr.Length;
for(int i=0;i<x/2;i++)
{
--x;
buffor = arr[x];
arr[x] = arr[i];
arr[i] = buffor;
}

Page 16 of 89
return arr;
}
}
SOLUTION 12 OF 12 – ZAD 5

public class Kata


{
public static string[] FixTheMeerkat(string[] arr)
{
//your code here
string[] new_arr = new string[3];
int n = 0;

for(int i = arr.Length; i > 0; i--){


new_arr[n] = arr[i-1];
n++;
}
return new_arr;
}
}

Page 17 of 89
ZADATAK 6/20 - BIG CITY

It's bonus time in the big city! The fatcats are rubbing their paws in
anticipation... but who is going to make the most money?

Build a function that takes in two arguments (salary, bonus).


Salary will be an integer, and bonus a boolean. Izbornik

If bonus is true, the salary should be multiplied by 10. If bonus is false,


the fatcat did not make enough money and must receive only his stated salary.

Return the total figure the individual will receive as a string prefixed
with "£" (= "\u00A3", JS, Go, Java and Julia), "$" (C#, C++, Ruby, Clojure,
Elixir, PHP, Python, Haskell and Lua) or "¥" (Rust).
SOLUTION 1 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus)
{
return $"${salary * (bonus ? 10 : 1)}";
}
}
SOLUTION 2 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus) => "$" + (bonus
? salary * 10 : salary);
}

Page 18 of 89
SOLUTION 3 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus)
{
return bonus ? $"${salary * 10}" : $"${salary}";
}
}
SOLUTION 4 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus)
{
int total = 0;
// your code
if(bonus){
total = salary * 10;
}
else{
total = salary;
}
return "$" + total;
}
}

Page 19 of 89
SOLUTION 5 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus)
{
var response = bonus ? salary * 10 : salary;

return "$" + response;


}
}
SOLUTION 6 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus)
{
return string.Format("${0}", bonus ? salary * 10 : salary);
}
}
SOLUTION 7 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus)
{
int value = bonus ? salary * 10 : salary;
return $"${value}";
}
}

Page 20 of 89
SOLUTION 8 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus)
{
// your code
if(bonus)
salary = salary *10;

string sal = "$"+salary;


return sal;
}
}
SOLUTION 9 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus)
{
return (bonus)
? "$" + (salary*10)
: "$" + salary;
}
}

Page 21 of 89
SOLUTION 10 OF 10 – ZAD 6

public static class Kata


{
public static string bonus_time(int salary, bool bonus)
{
if(bonus) {
return "$" + salary*10;
}
return "$" + salary;
}
}

Page 22 of 89
ZADATAK 7/20 - UPPERCASE

Is the string uppercase?

Create an extension method IsUpperCase to see whether the string is ALL


CAPS. For example:

"c".IsUpperCase() == false

"C".IsUpperCase() == true
Izbornik
"hello I AM DONALD".IsUpperCase() == false

"HELLO I AM DONALD".IsUpperCase() == true

"ACSKLDFJSgSKLDFJSKLDFJ".IsUpperCase() == false

"ACSKLDFJSGSKLDFJSKLDFJ".IsUpperCase() == true

In this Kata, a string is said to be in ALL CAPS whenever it does not


contain any lowercase letter so any string containing no letters at all is
trivially considered to be in ALL CAPS.

SOLUTION 1 OF 10 – ZAD 7

public static class StringExtensions


{
public static bool IsUpperCase(this string value)
{
return value.ToUpper() == value;
}
}

SOLUTION 2 OF 10 – ZAD 7

using System;
using System.Linq;

public static class StringExtensions


{
public static bool IsUpperCase(this string s)
{
return !s.Any(x => Char.IsLower(x));
}
}

Page 23 of 89
SOLUTION 3 OF 10 – ZAD 7

using System;

public static class StringExtensions


{
public static bool IsUpperCase(this string str)
{
return str == str.ToUpper();
}
}
SOLUTION 4 OF 10 – ZAD 7

public static class StringExtensions


{
public static bool IsUpperCase(this string str) => str == str.ToUpper();
}
SOLUTION 5 OF 10 – ZAD 7

using System.Collections.Generic;
using System.Linq;
public static class StringExtensions {
public static bool IsUpperCase(this string s) => new
List<char>(s).TrueForAll( x => !char.IsLower(x) );
}

Page 24 of 89
SOLUTION 6 OF 10 – ZAD 7

using System;

public static class StringExtensions{


public static bool IsUpperCase(this string str){
return str.ToUpper().Equals(str, StringComparison.Ordinal);
}
}
SOLUTION 7 OF 10 – ZAD 7

using System.Linq;

public static class StringExtensions{


public static bool IsUpperCase(this string str)
{
return !str.Any(x => char.IsLower(x));
}
}
SOLUTION 8 OF 10 – ZAD 7

public static class StringExtensions{


public static bool IsUpperCase(this string s)
{
return s.ToUpper() == s;
}
}

Page 25 of 89
SOLUTION 9 OF 10 – ZAD 7

using System.Text.RegularExpressions;

public static class StringExtensions{

public static bool IsUpperCase(this string s)


{
return Regex.IsMatch(s, "^$|^[^a-z]+$");
}

}
SOLUTION 10 OF 10 – ZAD 7

using System;

public static class StringExtensions{

public static bool IsUpperCase( this string s)


{
return s.ToUpper().Equals(s);
}

Page 26 of 89
ZADATAK 8/20 - CUBE

Create a public class called Cube without a constructor which gets one
single private integer variable Side, a getter GetSide() and a setter
SetSide(int num) method for this property. Actually, getter and setter
methods are not the common way to write this code in C#. In the next kata
of this series, we gonna refactor the code and make it a bit more
professional...

Izbornik
Notes:

There's no need to check for negative values!

initialise the side to 0.

SOLUTION 1 OF 10 – ZAD 8
using System;

public class Cube


{

private int side = 0;

public int GetSide() { return side; }

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

}
SOLUTION 2 OF 10 – ZAD 8
public class Cube
{
private int m_side = 0;

public int GetSide() => m_side;


public void SetSide(int value) => m_side = value;
}
SOLUTION 3 OF 10 – ZAD 8
using System;

public class Cube {

private int Side;

public int GetSide() {


return Side;
}

Page 27 of 89
public void SetSide(int num) {
Side = num;
}

}
SOLUTION 4 OF 10 – ZAD 8
public class Cube
{
private int _side = 0;

public int GetSide()


{
return this._side;
}

public void SetSide(int side)


{
this._side = side;
}
}
SOLUTION 5 OF 10 – ZAD 8
using System;

public class Cube


{
public int Side;

public int GetSide()


{
return this.Side;
}

public void SetSide(int s)


{
this.Side = s;
}
}
SOLUTION 6 OF 10 – ZAD 8
public class Cube {
private int Side;
public int GetSide() {
return Side;
}
public void SetSide(int s) {
Side = s;
}
}

Page 28 of 89
SOLUTION 7 OF 10 – ZAD 8
public class Cube
{
private int side;

public int SetSide(int value) => side = value;


public int GetSide() => side;
}

SOLUTION 8 OF 10 – ZAD 8
public class Cube
{
private int Side { get; set; } = 0;

public int GetSide()


{
return Side;
}

public void SetSide(int value)


{
Side = value;
}
}
SOLUTION 9 OF 10 – ZAD 8
public class Cube
{
private int side = 0;
public void SetSide(int side)
{
this.side = side;
}
public int GetSide()
{
return side;
}
}
SOLUTION 10 OF 10 – ZAD 8
public class Cube{
public int side=0;
public void SetSide(int s) {side=s;}
public int GetSide() {return side;}
}

Page 29 of 89
ZADATAK 9/20 - BETWEEN

Complete the function that takes two integers (a, b, where a < b) and
return an array of all integers between the input parameters, including
them.

For example: Izbornik

a = 1

b = 4

--> [1, 2, 3, 4]

SOLUTION 1 OF 10 – ZAD 9
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();
}
}
SOLUTION 2 OF 10 – ZAD 9
using System;
using System.Linq;

public static class Kata


{
public static int[] Between(int a, int b) => Enumerable.Range(a, b
- a + 1).ToArray();
}

Page 30 of 89
SOLUTION 3 OF 10 – ZAD 9
using System.Collections.Generic;

public static class Kata


{
public static int[] Between(int a, int b)
{
var result = new List<int>();
for (var i = a; i <= b; i++)
{
result.Add(i);
}
return result.ToArray();
}
}
SOLUTION 4 OF 10 – ZAD 9
using System.Linq;
using static System.Math;

public static class Kata


{
public static int[] Between(int a, int b)
{
return Enumerable.Range(Min(a, b), Abs(a - b) + 1).ToArray();
}
}

Page 31 of 89
SOLUTION 5 OF 10 – ZAD 9
using System;
using System.Linq;
using System.Collections.Generic;

public static class Kata


{
public static int[] Between(int a, int b)
{
List<int> lst = new List<int>();
for(int i = a; i <= b; i++){
lst.Add(i);
}
return lst.ToArray();

}
}
SOLUTION 6 OF 10 – ZAD 9

using System.Linq;
public static class Kata {
public static int[] Between(int a, int b) {
return Enumerable.Range(a, b - a + 1).ToArray();
}
}

Page 32 of 89
SOLUTION 7 OF 10 – ZAD 9
using System;
using System.Linq;

public static class Kata


{
public static int[] Between(int a, int b) =>
Enumerable.Range(Math.Min(a, b), Math.Abs(a - b) + 1).ToArray();
}

SOLUTION 8 OF 10 – ZAD 9
using System.Linq;

public static class Kata


{
public static int[] Between(int a, int b) => Enumerable.Range(a,b-
a+1).ToArray();
}
SOLUTION 9 OF 10 – ZAD 9

using System;
using System.Linq;

public static class Kata


{
public static int[] Between(int a, int b)
{
int minValue = Math.Min(a, b);
int maxValue = Math.Max(a, b);
int resultArraySize = maxValue - minValue + 1;

return Enumerable.Range(minValue, resultArraySize).ToArray();


}
}
SOLUTION 10 OF 10 – ZAD 9

using System.Linq;

public class Kata {


public static int[] Between(int a, int b) {
return Enumerable.Range(a, b-a+1).ToArray();
}
}

Page 33 of 89
ZADATAK 10/20 - EVEN OR ODD

Create a function (or write a script in Shell) that takes an integer as an


argument and returns "Even" for even numbers or "Odd" for odd numbers.

SOLUTION 1 OF 13 – ZAD 10
using System;

namespace Solution Izbornik


{
public class SolutionClass
{
public static string EvenOrOdd(int number)
{
return number % 2 == 0 ? "Even" : "Odd";
}
}
}
SOLUTION 2 OF 13 – ZAD 10
using System;

namespace Solution
{
public class SolutionClass
{
public static string EvenOrOdd(int number)
{
// Code goes here...
if(number % 2 == 0)
{
return("Even");
}
else
{
return("Odd");
}
}
}
}

Page 34 of 89
SOLUTION 3 OF 13 – ZAD 10
public class SolutionClass
{
public static string EvenOrOdd(int number)
=> number%2 == 0 ? "Even": "Odd";
}
SOLUTION 4 OF 13 – ZAD 10

class SolutionClass
{
public static string EvenOrOdd(int number)
{
return number % 2 == 0 ? "Even" : "Odd";
}
}
SOLUTION 5 OF 13 – ZAD 10
using System;

namespace Solution
{
public class SolutionClass
{
public static string EvenOrOdd(int number)
{
if(number % 2 == 0)
{
return "Even";
}
return "Odd";
}
}
}

Page 35 of 89
SOLUTION 6 OF 13 – ZAD 10

using System;

namespace Solution
{
public class SolutionClass
{
public static string EvenOrOdd(int number)
{
return (number & 1) == 0 ? "Even" : "Odd";
}
}
}
SOLUTION 7 OF 13 – ZAD 10

namespace Solution
{
public class SolutionClass
{
public static string EvenOrOdd(int x) => x % 2 == 0 ? "Even" : "Odd";
}
}
SOLUTION 8 OF 13 – ZAD 10

using System;

namespace Solution
{
public class SolutionClass
{
public static Func<int,string> EvenOrOdd = (x) => x % 2 == 0 ? "Even"
: "Odd";
}
}

Page 36 of 89
SOLUTION 9 OF 13 – ZAD 10

using System;

namespace Solution
{
public class SolutionClass
{
public static string EvenOrOdd(int number)
{
return (number & 1) == 0 ? "Even" : "Odd";
}
}
}
SOLUTION 10 OF 13 – ZAD 10

using System;

namespace Solution
{
public class SolutionClass
{
public static string EvenOrOdd(int number)
{
return new string[] {"Even", "Odd"}[number % 2];
}
}
}
SOLUTION 11 OF 13 – ZAD 10
using System.Reflection;

namespace Solution
{
public class SolutionClass
{
public static string EvenOrOdd(int number)
{
var magic = MethodBase.GetCurrentMethod().Name;
return number % 2 == 0 ? magic.Substring(0, 4) :
magic.Substring(6);
}
}
}

Page 37 of 89
SOLUTION 12 OF 13 – ZAD 10

using System;

namespace Solution
{
public class SolutionClass
{
public static string EvenOrOdd(int number)
{
return (number & 0x01) > 0 ? "Odd" : "Even";
}
}
}
SOLUTION 13 OF 13 – ZAD 10

namespace Solution
{
public class SolutionClass
{
public static string EvenOrOdd(int x) => x % 2 == 0 ? "Even" : "Odd";
}
}

Page 38 of 89
ZADATAK 11/20 - SUM OF POSITIVE

You get an array of numbers, return the sum of all of the


positives ones. Izbornik

Example [1,-4,7,12] => 1 + 7 + 12 = 20

Note: if there is nothing to sum, the sum is default to 0.

SOLUTION 1 OF 10 – ZAD 11

using System;
using System.Linq;

public class Kata


{
public static int PositiveSum(int[] arr)
{
return arr.Where(x => x > 0).Sum();
}
}
SOLUTION 2 OF 10 – ZAD 11

using System;
using System.Linq;

public class Kata


{
public static int PositiveSum(int[] arr)
{
return arr.Sum(c => (c < 0 ? 0 : c));
}
}

Page 39 of 89
SOLUTION 3 OF 10 – ZAD 11

using System;
using System.Linq;

public class Kata


{
public static int PositiveSum(int[] arr)
{
int sum = 0;

if (arr != null)
{
foreach (int i in arr)
{
if (i > 0)
{
sum += i;
}
else
{
sum += 0;
}
}
return sum;
}
return 0;
}
}
SOLUTION 4 OF 10 – ZAD 11

using System;
using System.Linq;

public class Kata


{
public static int PositiveSum(int[] arr) => arr.Where( x => x >
0).Sum();

Page 40 of 89
SOLUTION 5 OF 10 – ZAD 11

using System;
using System.Linq;

public class Kata


{
public static int PositiveSum(int[] arr)
{
return arr.Where(a => a > 0).Sum();
}
}
SOLUTION 6 OF 10 – ZAD 11

using System.Linq;

class Kata
{
public static int PositiveSum(int[] arr) => arr.Sum(i => i < 1 ? 0 : i);
}
SOLUTION 7 OF 10 – ZAD 11

using System;
using System.Linq;

public class Kata


{
public static int PositiveSum(int[] arr)
{
return arr.Sum(x => x > 0 ? x : 0);
}
}

Page 41 of 89
SOLUTION 8 OF 10 – ZAD 11

using System;
using System.Linq;

public class Kata


{
public static int PositiveSum(int[] arr)
{

int suma = 0;
int ile = arr.Count();
for(int i=0; i<ile;i++)
{
if(arr[i] > 0) suma += arr[i];
}
return suma;
}
}
SOLUTION 9 OF 10 – ZAD 11

using System;
using System.Linq;

public class Kata


{
public static int PositiveSum(int[] arr) => arr.Sum((x) => x <= 0 ? 0 :
x);
}
SOLUTION 10 OF 10 – ZAD 11

using System;
using System.Linq;

public class Kata


{
public static int PositiveSum(int[] arr) => arr.Sum(x => Math.Max(0,
x));
}

Page 42 of 89
ZADATAK 12/20 - BASIC REGEX

Basic regex tasks. Write a function that takes in a numeric


code of any length. The function should check if the code Izbornik
begins with 1, 2, or 3 and return true if so. Return false
otherwise.

You can assume the input will always be a number.

SOLUTION 1 OF 8 – ZAD 12

using System;
using System.Text.RegularExpressions;

public class Kata


{
public static bool ValidateCode(string code)
{
return Regex.IsMatch(code, "^[1-3]");
}
}
SOLUTION 2 OF 8 – ZAD 12

using System;
using System.Text.RegularExpressions;

public class Kata


{
public static bool ValidateCode(string code)
{
return Regex.IsMatch(code, @"^[1-3]");
}
}
SOLUTION 3 OF 8 – ZAD 12

using System.Text.RegularExpressions;

public class Kata


{
public static bool ValidateCode(string code) => Regex.IsMatch(code, "^[1-
3]+");
}

Page 43 of 89
SOLUTION 4 OF 8 – ZAD 12

using System.Text.RegularExpressions;

public class Kata


{
public static bool ValidateCode(string code)
{
return Regex.IsMatch(code, "^[123]");
}
}
SOLUTION 5 OF 8 – ZAD 12

using System;
using System.Text.RegularExpressions;
public class Kata {
public static bool ValidateCode(string code) => code != string.Empty ?
code[0] == '1' || code[0] == '2' || code[0] == '3' : false;
}
SOLUTION 6 OF 8 – ZAD 12

using System.Text.RegularExpressions;

public class Kata


{
public static bool ValidateCode(string code) =>
Regex.IsMatch(code,@"\A[1-3]");
}
SOLUTION 7 OF 8 – ZAD 12

using System;
using System.Text.RegularExpressions;

public class Kata


{
public static bool ValidateCode(string code)
{
return Regex.IsMatch(code, "^[1-3].*");
}
}

Page 44 of 89
SOLUTION 8 OF 8 – ZAD 12

using System;
using System.Text.RegularExpressions;

public class Kata


{
public static bool ValidateCode(string code)
{
Regex regex = new Regex(@"^[1-3]\d*");
return regex.IsMatch(code);
}
}

Page 45 of 89
ZADATAK 13/20 – CIRCULAR ARC A

Complete the function that calculates the area of the


red square, when the length of the circular arc A is
given as the input. Return the result rounded to two
decimals.

SOLUTION 1 OF 10 – ZAD 13

using System;

public class Kata


{
public static double SquareArea(double A)
{

Izbornik
double arcLength = A;
double angle = 90;
double radian = Math.PI * angle / 180;
double radius = arcLength / radian;
double sqRadius = radius * radius;
double result = Math.Round(sqRadius, 2);
return result;

}
}
SOLUTION 2 OF 10 – ZAD 13

using System;
public class Kata
{
public static double SquareArea(double A) => Math.Round((4 * A / (2 *
Math.PI)) * (4 * A / (2 * Math.PI)), 2);
}
SOLUTION 3 OF 10 – ZAD 13

using static System.Math;

public class Kata


{
public static double SquareArea(double A) => Round(4 * A * A / (PI * PI),
2);
}

Page 46 of 89
SOLUTION 4 OF 10 – ZAD 13
using System;

public class Kata


{
public static double SquareArea(double A)
{
var result= Math.Round(Math.Pow(2*A/Math.PI,2),2);

return result;

}
}
SOLUTION 5 OF 10 – ZAD 13

using System;
public class Kata
{
public static double SquareArea(double A)
{
return Math.Round(Math.Pow(4*A/(2*Math.PI),2),2);
}
}
SOLUTION 6 OF 10 – ZAD 13

using System;

public class Kata


{
public static double SquareArea(double A)
{
//A is one fourth of the Circumference of a circle where the radius is
the same as the side length of this square.
//C = 2 * PI * r
//A = C/4
//r = (4 * A) / (2 * PI) = 2 * A / PI
//area of the square = r * r
double r = 2 * A / Math.PI;
return Math.Round(r * r, 2);
}
}

Page 47 of 89
SOLUTION 7 OF 10 – ZAD 13

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static double SquareArea(double A)
{
double circumference = A * 4;
double diameter = circumference / Math.PI;
double radius = diameter / 2;
double area = Math.Pow(radius, 2);
return Math.Round(area, 2);
}
}
SOLUTION 8 OF 10 – ZAD 13

using static System.Math;

public class Kata


{
public static double SquareArea(double A)
{
var r = 2 * A / PI;
return Round(r * r, 2);
}
}
SOLUTION 9 OF 10 – ZAD 13

using System;

public class Kata


{
public static double SquareArea(double A) => Math.Round(4 * A * A /
Math.PI / Math.PI, 2);
}

Page 48 of 89
SOLUTION 10 OF 10 – ZAD 13

using System;
public class Kata
{
public static double SquareArea(double A)
{

return Math.Round((A/Math.PI*2)*(A/Math.PI*2), 2);


}
}

Page 49 of 89
ZADATAK 14/20 – CHAMPIONSHIP

Our football team finished the championship. The result of each match look
like "x:y". Results of all matches are recorded in the collection.

For example: ["3:1", "2:2", "0:1", ...]

Write a function that takes such collection and counts the points of our
team in the championship. Rules for counting points for each match:

• if x>y - 3 points
• if x<y - 0 point Izbornik
• if x=y - 1 point
Notes:

• there are 10 matches in the championship


• 0 <= x <= 4
• 0 <= y <= 4
SOLUTION 1 OF 14 – ZAD 14

using System.Linq;
using System;
public static class Kata {
public static int TotalPoints(string[] games) {
int total = 0;
foreach (string game in games) {
if (game[0] > game[2])
total += 3;
else if (game[0] == game[2])
total += 1;
}
return total;
}
}
SOLUTION 2 OF 14 – ZAD 14
using System.Linq;

public static class Kata


{
public static int TotalPoints(string[] games)
{
return games.Sum(s => s[0] < s[2] ? 0 : s[0] == s[2] ? 1 : 3);
}
}

Page 50 of 89
SOLUTION 3 OF 14 – ZAD 14

using System.Linq;

public static class Kata {


public static int TotalPoints(string[] games) {
return games.Select(x => CalculatePoints(x)).Sum();
}

public static int CalculatePoints(string game){


var scores = game.Split(":");
if(int.Parse(scores[0]) > int.Parse(scores[1])) return 3;
if(int.Parse(scores[0]) < int.Parse(scores[1])) return 0;
return 1;
}
}
SOLUTION 4 OF 14 – ZAD 14
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public static class Kata {


public static int TotalPoints(string[] games) {
return games.Select(x =>
{
var values = x.Split(':').Select(int.Parse);

if (values.ElementAt(0) > values.ElementAt(1))


{
return 3;
}

return values.ElementAt(0) < values.ElementAt(1)


? 0
: 1;
}).Sum(x => x);
}
}

Page 51 of 89
SOLUTION 5 OF 14 – ZAD 14

using System;

public static class Kata {


public static int TotalPoints(string[] games)
{
var points = 0;
foreach (var item in games)
{
points += (item[0] > item[2]) ? 3 : (item[0] == item[2]) ? 1 :
0;
}
return points;
}
}
SOLUTION 6 OF 14 – ZAD 14

using System.Linq;

public static class Kata {


public static int TotalPoints(string[] games) =>
games.Select(e =>(x:e[0], y:e[2])).Select(e => e.x > e.y ? 3 : e.x
== e.y ? 1 : 0).Sum();
}
SOLUTION 7 OF 14 – ZAD 14

using System.Linq;

public static class Kata {


public static int TotalPoints(string[] games)
{
return games.Where(x => x[0] > x[2]).Count()*3 +
games.Where(y=>y[0]==y[2]).Count();
}
}

Page 52 of 89
SOLUTION 8 OF 14 – ZAD 14

using System.Linq;

public static class Kata {


public static int TotalPoints(string[] games) =>
games.Select(e =>(x:e[0], y:e[2])).Select(e => e.x > e.y ? 3 : e.x
== e.y ? 1 : 0).Sum();
}
SOLUTION 9 OF 14 – ZAD 14

using System.Linq;
using System;
public static class Kata {
public static int TotalPoints(string[] games) {
int total = 0;
foreach (string game in games) {
if (game[0] > game[2])
total += 3;
else if (game[0] == game[2])
total += 1;
}
return total;
}
}

Page 53 of 89
SOLUTION 10 OF 14 – ZAD 14
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public static class Kata {


public static int TotalPoints(string[] games) {
return games.Select(x =>
{
var values = x.Split(':').Select(int.Parse);

if (values.ElementAt(0) > values.ElementAt(1))


{
return 3;
}

return values.ElementAt(0) < values.ElementAt(1)


? 0
: 1;
}).Sum(x => x);
}
}
SOLUTION 11 OF 14 – ZAD 14
using System;

public static class Kata {


public static int TotalPoints(string[] games)
{
var points = 0;
foreach (var item in games)
{
points += (item[0] > item[2]) ? 3 : (item[0] == item[2]) ? 1 :
0;
}
return points;
}
}

Page 54 of 89
SOLUTION 12 OF 14 – ZAD 14

using System.Linq;

public static class Kata {


public static int toInt(char c){
switch(c){
case '0': return 0; break;
case '1': return 1; break;
case '2': return 2; break;
case '3': return 3; break;
case '4': return 4; break;
case '5': return 5; break;
case '6': return 6; break;
case '7': return 7; break;
case '8': return 8; break;
default: return 9;
}
}
public static int TotalPoints(string[] games) {
int points = 0;
foreach(string c in games){
int x = toInt(c[0]);
int y = toInt(c[2]);
if(x>y) points+=3;
else if(x==y)points+=1;
}
return points;
}
}

Page 55 of 89
SOLUTION 13 OF 14 – ZAD 14
using System.Linq;

public static class Kata {


public static int TotalPoints(string[] games) => games.Select(s =>
s[0].GetHashCode() - s[2].GetHashCode())
.Where(v => v
>= 0)
.Sum(v => v ==
0 ? 1 : 3);
}
SOLUTION 14 OF 14 – ZAD 14
using System;
using System.Text.RegularExpressions;

public static class Kata {


public static int TotalPoints(string[] games)
{
int points = 0;
string hold;
int x, y;

for (int i = 0; i < games.Length; i++)


{
hold = games[i];
x = (int)Char.GetNumericValue(hold[0]);
y = (int)Char.GetNumericValue(hold[2]);
if(x > y)
{
points += 3;
}else if(x == y)
{
points += 1;
}
}

return points;
}
}

Page 56 of 89
ZADATAK 15/20 - GENERATE RANGE

Implement a function named generateRange(min, max, step), which takes


three arguments and generates a range of integers from min to max, with
the step. The first integer is the minimum value, the second is the
maximum of the range and the third is the step. (min < max)

Task

Implement a function named


Izbornik
GenerateRange(2, 10, 2) == new int[]{ 2, 4, 6, 8, 10 }

GenerateRange(1, 10, 3) == new int[]{ 1, 4, 7, 10 }

Note

• min < max


• step > 0
• the range does not HAVE to include max (depending on the step)

SOLUTION 1 OF 15 – ZAD 15

using System.Collections.Generic;

public class Kata


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

List<int> int_arr= new List<int>();


for(int i=min;i<=max;i+=step)
{
int_arr.Add(i);
}
return int_arr.ToArray();
}
}
SOLUTION 2 OF 15 – ZAD 15

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{
int[] res = new int[((max - min) / step)+1];
res[0] = min;

Page 57 of 89
for (int i = 1; i < res.Length; i++)
{
res[i] = res[i - 1]+step;
}
return res;
}
}
SOLUTION 3 OF 15 – ZAD 15

using System;
using System.Linq;

public class Kata


{
public static int[] GenerateRange(int min, int max, int s) =>
Enumerable.Range(0, 1+(max-min)/s).Select(i => min + i * s).ToArray();
}
SOLUTION 4 OF 15 – ZAD 15

using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{
return Range(min, max, step).ToArray();
}

private static IEnumerable<int> Range(int min, int max, int step)


{
for (int i = min; i <= max; i += step)
{
yield return i;
}
}
}

Page 58 of 89
SOLUTION 5 OF 15 – ZAD 15
using System.Collections.Generic;

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{
var list = new List<int>();

for (var i = min; i <= max; i+= step)


{
list.Add(i);
}

return list.ToArray();
}
}
SOLUTION 6 OF 15 – ZAD 15

using System.Collections.Generic;
using System.Linq;
public class Kata
{
public static int[] GenerateRange(int min, int max, int step)
{
return Enumerable
.Repeat(min, (int)((max - min) / step) + 1)
.Select((tr, ti) => tr + (step * ti))
.ToArray();
}
}
SOLUTION 7 OF 15 – ZAD 15

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

Page 59 of 89
SOLUTION 8 OF 15 – ZAD 15

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{
if (min > max || step < 0)
throw new System.Exception();

int[] result = new int[1 + (max-min)/step];


for(int i=0; min<=max; min += step, i++)
result[i] = min;
return result;
}
}
SOLUTION 9 OF 15 – ZAD 15

using System;
using System.Linq;

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{
var range = Enumerable.Range(min, max-min+1).ToList();
range.RemoveAll(n => range.IndexOf(n) % step != 0);
return range.ToArray();
}
}

Page 60 of 89
SOLUTION 10 OF 15 – ZAD 15
using System.Collections.Generic;

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{
var list = new List<int>();

for (var i = min; i <= max; i+= step)


{
list.Add(i);
}

return list.ToArray();
}
}
SOLUTION 11 OF 15 – ZAD 16
using System.Collections.Generic;
public class Kata
{
public static int[] GenerateRange(int min, int max, int step)
{
List<int> myList = new List<int>();
while (min <= max)
{
myList.Add(min);
min += step;
}
int[] arr = myList.ToArray();
return arr;
}
SOLUTION 12 OF 15 – ZAD 16
public class Kata
{
public static int[] GenerateRange(int min, int max, int step)
{
int number = ((max - min) / step) + 1;
int[] arr = new int[number];
for (int i = 0; i < arr.Length; i++)
{
arr[i] = min + (i * step);
}
return arr;
}
}

Page 61 of 89
SOLUTION 13 OF 15 – ZAD 16
using System;

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{
int[] res = new int[(max-min)/step+1];
int b =0;
for(int i = min; i <= max; i+=step){
res[b] = i;

Console.WriteLine(res[b]);
b++;
}
return res;
}
}
SOLUTION 14 OF 15 – ZAD 16
using System;
using System.Collections.Generic;

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{
List<int> result = new List<int>();
for(var i = min; i <= max;) {result.Add(i); i += step;}
return result.ToArray();
}
}
SOLUTION 15 OF 15 – ZAD 16
using System.Collections.Generic;

public class Kata


{
public static int[] GenerateRange(int min, int max, int step)
{
List<int> l = new List<int>();
for (int i = min; i <= max; i+=step)
l.Add(i);
return l.ToArray();
}
}

Page 62 of 89
ZADATAK 16/20 - HOLIDAY VI - SHARK PONTOON
Your friend invites you out to a cool floating pontoon around 1km off the
beach. Among other things, the pontoon has a huge slide that drops you out
right into the ocean, a small way from a set of stairs used to climb out.

As you plunge out of the slide into the water, you see a shark hovering in
the darkness under the pontoon... Crap!

You need to work out if the shark will get to you before you can
get to the pontoon. To make it easier... as you do the mental Izbornik
calculations in the water you either freeze when you realise you
are dead, or swim when you realise you can make it!

You are given 5 variables;

• sharkDistance = distance from the shark to the pontoon. The shark will
eat you if it reaches you before you escape to the pontoon.

• sharkSpeed = how fast it can move in metres/second.

• pontoonDistance = how far you need to swim to safety in metres.

• youSpeed = how fast you can swim in metres/second.

• dolphin = a boolean, if true, you can half the swimming speed of the
shark as the dolphin will attack it.

• The pontoon, you, and the shark are all aligned in one dimension.

If you make it, return "Alive!", if not, return "Shark Bait!".


SOLUTION 1 OF 10 – ZAD 16

public class Kata


{
public static string Shark(int pontoonDistance, int sharkDistance, int
yourSpeed, int sharkSpeed, bool dolphin)
{
return pontoonDistance * sharkSpeed < yourSpeed * sharkDistance *
(dolphin ? 2 : 1)
? "Alive!"
: "Shark Bait!";
}
}

Page 63 of 89
SOLUTION 2 OF 10 – ZAD 16
public class Kata
{
public static string Shark(
int pontoonDistance,
int sharkDistance,
int yourSpeed,
int sharkSpeed,
bool dolphin)
{
//your code here
return ((float)sharkDistance / sharkSpeed) >
((float)pontoonDistance / (dolphin ? yourSpeed * 2 : yourSpeed)) ? "Alive!"
: "Shark Bait!";
}
}
SOLUTION 3 OF 10 – ZAD 16
public class Kata
{
public static string Shark(
int pontoonDistance,
int sharkDistance,
int yourSpeed,
int sharkSpeed,
bool dolphin)
{
if(dolphin==true)
{
sharkSpeed/=2;
}
float Tt = (float)sharkDistance/sharkSpeed;
float Tp = (float)pontoonDistance/yourSpeed;
if((Tt) > (Tp))
{
return "Alive!";
}
else
{
return "Shark Bait!";
}
}
}

Page 64 of 89
SOLUTION 4 OF 10 – ZAD 16
public class Kata
{
public static string Shark(
int pontoonDistance,
int sharkDistance,
int yourSpeed,
int sharkSpeed,
bool dolphin)
{

for(int i = 0; i < pontoonDistance; i = i + yourSpeed)


{
if(dolphin)
{
sharkDistance = sharkDistance - (sharkSpeed / 2);
}
else
{
sharkDistance = sharkDistance - sharkSpeed;
}
}

if(sharkDistance <= 0)
{
return "Shark Bait!";
}
else
{
return "Alive!";
}

}
}

Page 65 of 89
SOLUTION 5 OF 10 – ZAD 16
public class Kata
{
public static string Shark(
int pontoonDistance,
int sharkDistance,
int yourSpeed,
int sharkSpeed,
bool dolphin)
{
if (dolphin)
{ sharkSpeed /= 2; }

while (sharkDistance > 0)


{
pontoonDistance -= yourSpeed;
sharkDistance -= sharkSpeed;
if (sharkDistance < pontoonDistance)
{ continue; }
if (pontoonDistance <= 0 )
{ return "Alive!"; }

return "Shark Bait!";


}
}
SOLUTION 6 OF 10 – ZAD 16
public class Kata
{
public static string Shark(
int pontoonDistance,
int sharkDistance,
int yourSpeed,
int sharkSpeed,
bool dolphin)
{
//your code here
return ((float)sharkDistance / sharkSpeed) >
((float)pontoonDistance / (dolphin ? yourSpeed * 2 : yourSpeed)) ? "Alive!"
: "Shark Bait!";
}
}

Page 66 of 89
SOLUTION 7 OF 10 – ZAD 16
public class Kata
{
public static string Shark(
int pontoonDistance,
int sharkDistance,
int yourSpeed,
int sharkSpeed,
bool dolphin)
{
if (dolphin)
{ sharkSpeed /= 2; }

while (sharkDistance > 0)


{
pontoonDistance -= yourSpeed;
sharkDistance -= sharkSpeed;
if (sharkDistance < pontoonDistance)
{ continue; }
if (pontoonDistance <= 0 )
{ return "Alive!"; }

return "Shark Bait!";


}
}
SOLUTION 8 OF 10 – ZAD 16
public class Kata
{
public static string Shark(
int pontoonDistance,
int sharkDistance,
int yourSpeed,
int sharkSpeed,
bool dolphin)
{
if (dolphin)
sharkSpeed = sharkSpeed / 2;

double ourTime = (double)pontoonDistance / (double)yourSpeed;


double sharkTime = (double)sharkDistance / (double)sharkSpeed;

if (ourTime < sharkTime)


return "Alive!";
else
return "Shark Bait!";

}
}

Page 67 of 89
SOLUTION 9 OF 10 – ZAD 16
using System;

public class Kata


{
public static string Shark(
int pontoonDistance,
int sharkDistance,
int yourSpeed,
int sharkSpeed,
bool dolphin)
{
if (dolphin)
sharkSpeed = sharkSpeed / 2;

double ourTime = (double)pontoonDistance / (double)yourSpeed;


double sharkTime = (double)sharkDistance / (double)sharkSpeed;

if (ourTime <= sharkTime)


return "Alive!";
else
return "Shark Bait!";
}
}

Page 68 of 89
SOLUTION 10 OF 10 – ZAD 16
public class Kata
{
public static string Shark(
int pontoonDistance,
int sharkDistance,
int yourSpeed,
int sharkSpeed,
bool dolphin)
{
if(sharkSpeed == 0)
return "Alive";
if(yourSpeed == 0)
return "Shark Bait!";
if(dolphin)
{

if(sharkDistance/(sharkSpeed/2) <= pontoonDistance/yourSpeed)


return "Shark Bait!";
else
return "Alive!";
}
else
{
if(sharkDistance/(sharkSpeed) <= pontoonDistance/yourSpeed)
return "Shark Bait!";
else
return "Alive!";
}

}
}

Page 69 of 89
ZADATAK 17/20 - PICK A SET OF FIRST ELEMENTS

Write a JavaScript function to get the first element of an array. Passing


a parameter n (default=1) will return the first n elements of the array.
If n == 0 return an empty array ([]);

Examples Izbornik
var arr = new object[] { 'a', 'b', 'c', 'd', 'e' };
Kata.TakeFirstElements(arr); //=> new object[] { 'a' }
Kata.TakeFirstElements(arr, 2);// => new object[] { 'a', 'b' }
Kata.TakeFirstElements(arr, 3); //=> new object[] { 'a', 'b', 'c' }
Kata.TakeFirstElements(arr, 0); //=> new object[] { }

SOLUTION 1 OF 10 – ZAD 17
using System.Linq;
public class Kata {
public static object[] TakeFirstElements(object[] array, int n = 1) =>
array.Take(n).ToArray();
}

SOLUTION 2 OF 10 – ZAD 17
using System.Linq;

public class Kata


{
public static object[] TakeFirstElements(object[] array, int n = 1)
{
return array.Take(n).ToArray();
}
}

SOLUTION 3 OF 10 – ZAD 17
public class Kata
{
public static object[] TakeFirstElements(object[] array, int n = 1)
{
n = n > array.Length ? array.Length : n;
object[] ans = new object[n];
for (int i = 0; i < n; i++) ans[i] = array[i];
return n == 0 ? new object[] {} : ans;
}
}

Page 70 of 89
SOLUTION 4 OF 10 – ZAD 17
using System.Linq;

public class Kata


{
public static object[] TakeFirstElements(object[] array, int n = 1)
{
return n == 0 ? new object[] { } : array.Take(n).ToArray();
}
}
SOLUTION 5 OF 10 – ZAD 17
public class Kata
{
public static object[] TakeFirstElements(object[] array, int n = 1)
{
if(n<=0){return new object[]{};}
if(n>array.Length){return array;}
object[] Output = new object[n];
for(int i=0; i<n; i++)
{
Output[i] = array[i];
}
return Output;
}
}
SOLUTION 6 OF 10 – ZAD 17
using System.Linq;
public class Kata {
public static object[] TakeFirstElements(object[] array, int n = 1) =>
array.Take(n).ToArray();
}

SOLUTION 7 OF 10 – ZAD 17
public class Kata
{
public static object[] TakeFirstElements(object[] array, int n = 1)
{
n = n > array.Length ? array.Length : n;
object[] ans = new object[n];
for (int i = 0; i < n; i++) ans[i] = array[i];
return n == 0 ? new object[] {} : ans;
}
}

Page 71 of 89
SOLUTION 8 OF 10 – ZAD 17
using System.Linq;

public class Kata


{
public static object[] TakeFirstElements(object[] array, int n = 1)
{
return array.Take(n).ToArray();
}
}
SOLUTION 9 OF 10 – ZAD 17
using System;

public class Kata


{
public static object[] TakeFirstElements(object[] array, int n = 1)
{
if (n > array.Length)
{
return array;
}

object[] result = new object[n];


for (int i = 0; i < n; i++)
{
result[i] = array[i];
}
return result;
}
}
SOLUTION 10 OF 10 – ZAD 17
using System.Linq;

public class Kata


{
public static object[] TakeFirstElements(object[] array, int n = 1)
{
return n == 0 ? new object[] { } : array.Take(n).ToArray();
}
}

Page 72 of 89
ZADATAK 18/20 – POLE VAULT STARTING MARKS
For a pole vaulter, it is very important to begin the approach run at the
best possible starting mark. This is affected by numerous factors and
requires fine-tuning in practice. But there is a guideline that
will help a beginning vaulter start at approximately the right Izbornik
location for the so-called "three-step approach," based on the
vaulter's body height.

This guideline was taught to me in feet and inches, but due to the
international nature of Codewars, I am creating this kata to use metric
units instead.

You are given the following two guidelines to begin with: (1) A vaulter with
a height of 1.52 meters should start at 9.45 meters on the runway. (2) A
vaulter with a height of 1.83 meters should start at 10.67 meters on the
runway.

You will receive a vaulter's height in meters (which will always lie in a
range between a minimum of 1.22 meters and a maximum of 2.13 meters). Your
job is to return the best starting mark in meters, rounded to two decimal
places.

Hint: Based on the two guidelines given above, you will want to account for
the change in starting mark per change in body height. This involves a linear
relationship. But there is also a constant offset involved. If you can
determine the rate of change described above, you should be able to determine
that constant offset.
SOLUTION 1 OF 10 – ZAD 18
using System;

class PoleVault
{
public static double StartingMark(double bodyHeight)
{
return Math.Round((3.93548 * bodyHeight + 10.67 - 3.93548 * 1.83) * 100)
/ 100;
}
}
SOLUTION 2 OF 10 – ZAD 18
using System;

class PoleVault
{
public static double StartingMark(double bodyHeight) => Math.Round(1.22/
0.31 * bodyHeight + 9.45 - (1.52 * 1.22 /0.31 ),2);
}

Page 73 of 89
SOLUTION 3 OF 10 – ZAD 18
using System;

class PoleVault
{
public static double StartingMark(double bodyHeight)
{
return Math.Round(m * bodyHeight + b.Item2 - m * b.Item1, 2);
}
static readonly Tuple<double, double> a = Tuple.Create(1.52, 9.45);
static readonly Tuple<double, double> b = Tuple.Create(1.83, 10.67);
static readonly double m = (b.Item2 - a.Item2) / (b.Item1 - a.Item1);
}
SOLUTION 4 OF 10 – ZAD 18
using System;

class PoleVault
{
public static double StartingMark(double bodyHeight)
{
var heightVariation = 1.83-1.52;
var markVariation = 10.67-9.45;
double initialHeight = 1.52;
double initialMark = 9.45;
var markPerHeight = markVariation/heightVariation;

return Math.Round(initialMark+(bodyHeight-
initialHeight)*markPerHeight,2);

}
}
SOLUTION 5 OF 10 – ZAD 18
using System;

class PoleVault
{
public static double StartingMark(double bodyHeight)
{
double delta = (11.85-8.27)/(2.13-1.22);
return Math.Round(11.85 - (2.13-bodyHeight)*delta,2);
}
}
SOLUTION 6 OF 10 – ZAD 18
class PoleVault
{
public static double StartingMark(double bodyHeight)
=> System.Math.Round(1.22 / 0.31 * bodyHeight + 9.45 - 1.22 * 1.52 /
0.31,2);
}

Page 74 of 89
SOLUTION 7 OF 10 – ZAD 18
using System;

class PoleVault
{
public static double StartingMark(double bodyHeight)
{
return
Convert.ToDouble(String.Format("{0:0.00}",bodyHeight*3.9354838709677+3.468
064516129));
}
}
SOLUTION 8 OF 10 – ZAD 18
using System;

class PoleVault
{
public static double StartingMark(double bodyHeight)
{
double delta = (11.85-8.27)/(2.13-1.22);
return Math.Round(11.85 - (2.13-bodyHeight)*delta,2);
}
}
Solution 9 – zad 18
using System;

class PoleVault
{
public static double StartingMark(double bodyHeight) => Math.Round(1.22/
0.31 * bodyHeight + 9.45 - (1.52 * 1.22 /0.31 ),2);
}
SOLUTION 9 OF 10 – ZAD 18
using System;
class PoleVault
{
public static double StartingMark(double bodyHeight)
{
// Remember: Body height of 1.52 m --> starting mark: 9.45 m
// Body height of 1.83 m --> starting mark: 10.67 m
// All other starting marks are based on these guidelines!

/*
Using test cases

Sum of X = 6.7
Sum of Y = 40.24
Mean X = 1.675
Mean Y = 10.06
Sum of squares (SSX) = 0.4621
Sum of products (SP) = 1.818

Page 75 of 89
Regression Equation = ŷ = bX + a

b = SP/SSX = 1.82/0.46 = 3.93421

a = MY - bMX = 10.06 - (3.93*1.68) = 3.47019

ŷ = 3.93421X + 3.47019
*/
Console.WriteLine($"{bodyHeight} {Math.Round(bodyHeight * 3.93421 +
3.47019,2)}");
return Math.Round(bodyHeight * 3.93421 + 3.47019,2);
}
}
SOLUTION 10 OF 10 – ZAD 18

using System;

class PoleVault

public static double StartingMark(double bodyHeight)

// Remember: Body height of 1.52 m --> starting mark: 9.45 m

// Body height of 1.83 m --> starting mark: 10.67 m

// All other starting marks are based on these guidelines!

double slope = (10.67 - 9.45) / (1.83 - 1.52);

double n = 9.45 - slope * 1.52;

return Math.Round(bodyHeight * slope + n, 2);

Page 76 of 89
ZADATAK 19/20 – FILTERING EVEN NUMBERS (BUG FIXES)

Fix the bug in Filtering method

The method is supposed to remove even numbers from the list and return a
list that contains odd number.

However, there is a bug in the method that needs to be resolved.

SOLUTION 1 OF 16 – ZAD 19

using System;
using System.Collections.Generic; Izbornik

using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> numbers)
{
return numbers.Where(n => n % 2 == 1).ToList();
}
}
SOLUTION 2 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
for (int i = 0; i < listOfNumbers.Count; i++)
{
if (listOfNumbers[i] % 2 == 0)
{
listOfNumbers.RemoveAt(i--);
}
}
return listOfNumbers;
}
}

Page 77 of 89
SOLUTION 3 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
for (int i = 0; i < listOfNumbers.Count; i++)
{
if (listOfNumbers[i]%2 == 0)
{
listOfNumbers.RemoveAt(i);
i--;
}
}
return listOfNumbers;
}
}
SOLUTION 4 OF 16 – ZAD 19
using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
for (int i = listOfNumbers.Count-1; i >= 0; i--)
{
if (listOfNumbers[i]%2 == 0)
{
listOfNumbers.RemoveAt(i);
}
}
return listOfNumbers;
}
}

Page 78 of 89
SOLUTION 5 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
listOfNumbers.RemoveAll(i => i % 2 == 0);
return listOfNumbers;
}
}
SOLUTION 6 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> numbers)
{
return numbers.Where(n => n % 2 == 1).ToList();
}
}

Page 79 of 89
SOLUTION 7 OF 16 – ZAD 19
using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
for (int i = 0; i < listOfNumbers.Count; i++)
{
if (listOfNumbers[i] % 2 == 0)
{
listOfNumbers.RemoveAt(i--);
}
}
return listOfNumbers;
}
}
SOLUTION 8 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
listOfNumbers.RemoveAll(i => i % 2 == 0);
return listOfNumbers;
}
}
SOLUTION 9 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers) =>
listOfNumbers.Where( x => x % 2 == 1 ).ToList();
}

Page 80 of 89
SOLUTION 10 OF 16 – ZAD 19

using System.Linq;
using System.Collections.Generic;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
return listOfNumbers.Where(x => x % 2 == 1).ToList();
}
}
SOLUTION 11 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
int i = 0;
while (i < listOfNumbers.Count)
{
if (listOfNumbers[i]%2 == 0)
{
listOfNumbers.RemoveAt(i);
}
else
i++;
}
return listOfNumbers;
}
}

Page 81 of 89
SOLUTION 12 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
List<int> odds = new List<int>();

foreach (int i in listOfNumbers)


if (i % 2 != 0)
odds.Add(i);

return odds;
}
}
SOLUTION 13 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
return listOfNumbers.FindAll(x => x % 2 != 0).ToList();
}
}
SOLUTION 14 OF 16 – ZAD 19

using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)

Page 82 of 89
{
List<int> NewList = new List<int>();

for (int i = 0; i < listOfNumbers.Count; i++)


if (listOfNumbers[i]%2 != 0)
NewList.Add(listOfNumbers[i]);

return NewList;
}
}
SOLUTION 15 OF 16 – ZAD 19
using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
{
List<int> numbers = new List<int>();
for (int i = 0; i < listOfNumbers.Count; i++)
{
if (listOfNumbers[i] % 2 == 0)
{
numbers.Add(listOfNumbers[i]);
}
}

foreach (int number in numbers)


{
listOfNumbers.Remove(number);
}
return listOfNumbers;
}
}
SOLUTION 16 OF 16 – ZAD 19
using System;
using System.Collections.Generic;
using System.Linq;

public class Kata


{
public static List<int> FilterOddNumber(List<int> listOfNumbers)
=> listOfNumbers.Where((i) => i % 2 != 0).ToList(); ///
}

Page 83 of 89
ZADATAK 20/20 - TAKE AN ARROW TO THE KNEE, FUNCTIO NALLY
Arrow style Functions
Come here to practice the Arrow style functions Not much else to say good
luck!
Details

You will be given an array of numbers which can be used using the
String.fromCharCode() (JS), Tools.FromCharCode() (C#) method to convert the
number to a character. It is recommended to map over the array of numbers
and convert each number to the corresponding ascii character.

Examples
Izbornik
These are example of how to convert a number to an ascii
Character:
Javascript => String.fromCharCode(97) // a
C# => Tools.FromCharCode(97) // a

Reference: https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

SOLUTION 1 OF 10 – ZAD 20
using System;
using System.Linq;

// Preloaded method Tools.FromCharCode(int i) available!

public class Kata


{
public static string ArrowFunc(int[] arr)
{
return string.Join("", arr.Select( num => Tools.FromCharCode(num)
).ToArray());
}
}
SOLUTION 2 OF 10 – ZAD 20
using System;
using System.Linq;

public class Kata


{
public static string ArrowFunc(int[] arr)
{
return string.Concat(arr.Select(n => (char)n));
}
}

Page 84 of 89
SOLUTION 3 OF 10 – ZAD 20

using System;

using System.Linq;

public class Kata

public static string ArrowFunc(int[] arr) => string.Join("",


arr.Select(i => Tools.FromCharCode(i)).ToArray());

SOLUTION 4 OF 10 – ZAD 20
using System;
using System.Linq;

// Preloaded method Tools.FromCharCode(int i) available!

public class Kata


{
public static string ArrowFunc(int[] arr)
{
return string.Join("", arr.Select( a => (char)a ).ToArray());
}
}
SOLUTION 5 OF 10 – ZAD 20
using System;
using System.Linq;

// Preloaded method Tools.FromCharCode(int i) available!

public class Kata


{
public static string ArrowFunc(int[] arr)
{
return string.Join("", arr.Select( character =>
Tools.FromCharCode(character)).ToArray());
}
}
SOLUTION 6 OF 10 – ZAD 20

using System.Linq;

public class Kata {


public static string ArrowFunc(int[] arr) => string.Join("", arr.Select(
Tools.FromCharCode ));
}

Page 85 of 89
SOLUTION 7 OF 10 – ZAD 20
using System;
using System.Linq;

public class Kata


{
public static string ArrowFunc(int[] arr)
{
return string.Join("", arr.Select(n => Convert.ToChar(n)));
}
}
SOLUTION 8 OF 10 – ZAD 20
using System;
using System.Linq;

// Preloaded method Tools.FromCharCode(int i) available!

public class Kata


{
public static string ArrowFunc(int[] arr)
{
return string.Join("",
arr.Select(cell=>Tools.FromCharCode(cell)).ToArray());
}
}
SOLUTION 9 OF 10 – ZAD 20
using System;
using System.Linq;

// Preloaded method Tools.FromCharCode(int i) available!

public class Kata


{
public static string ArrowFunc(int[] arr)
{
return string.Join("", arr.Select(x => (char)x));
}
}
SOLUTION 10 OF 10 – ZAD 20
using System;
using System.Linq;

// Preloaded method Tools.FromCharCode(int i) available!

public class Kata


{
public static string ArrowFunc(int[] arr)
=> string.Concat(arr.Select(x=>Tools.FromCharCode(x)));
}

Page 86 of 89
KAZALO POJMOVA

$
G
$ 2, 18, 19, 20, 21, 22, 26, 76
GetCurrentMethod ................................................... 37

=
I
=>1, 2, 3, 4, 8, 9, 11, 12, 13, 18, 23, 24, 25, 27, 29, 30,
33, 35, 36, 38, 39, 40, 41, 42, 43, 44, 46, 48, 50, 51, IndexOf ....................................................................... 60
52, 53, 54, 56, 58, 59, 60, 70, 71, 73, 74, 75 IsLower ........................................................... 23, 24, 25
IsMatch ..................................................... 26, 43, 44, 45

0
J
0x01 ............................................................................. 38
Join ............................................................................... 3

A
L
Abs ......................................................................... 31, 33
Add ..................................................31, 32, 57, 59, 61, 62 Length .............. 1, 4, 5, 15, 16, 17, 56, 58, 61, 70, 71, 72
List ..........................................24, 31, 32, 57, 59, 61, 62

B
M
bool 7, 8, 9, 10, 11, 18, 19, 20, 21, 22, 23, 24, 25, 26, 43,
44, 45, 63, 64, 65, 66, 67, 68, 69 Math .......... 1, 5, 31, 33, 42, 46, 47, 48, 49, 73, 74, 75, 76
max.................................................. 57, 58, 59, 60, 61, 62
Max.......................................................................... 33, 42
C min.................................................. 57, 58, 59, 60, 61, 62

char ......................................................... 2, 3, 24, 25, 55


continue............................................................... 66, 67 N
Count ..................................................................... 42, 52
new 3, 8, 16, 17, 24, 31, 32, 37, 45, 57, 59, 60, 61, 62, 70,
71, 72
E null ............................................................................. 40

ElementAt ............................................................ 51, 54


Empty ..................................................................... 15, 44 O
Enumerable ............................. 30, 31, 32, 33, 58, 59, 60
Equals ................................................................... 25, 26 OrderByDescending ............................................... 2, 3

F P

for 4, 8, 12, 15, 16, 17, 27, 31, 32, 34, 42, 50, 56, 57, 58, Parse ............................................................. 2, 3, 51, 54
59, 60, 61, 62, 65, 70, 71, 72, 73 PI46, 47, 48, 49
foreach .................................. 5, 6, 40, 50, 52, 53, 54, 55 Pow...................................................................... 1, 47, 48
Format ................................................................... 20, 75 private ..................................................... 27, 28, 29, 58
Func ......................................................................... 8, 36
R

Range ..................................30, 31, 32, 33, 57, 58, 59, 60


regex ..................................................................... 43, 45

Page 87 of 89
RemoveAll .................................................................. 60
U
Repeat ......................................................................... 59
Reverse ....................................................... 3, 12, 13, 14
using System.Linq 2, 3, 4, 5, 6, 12, 13, 14, 23, 24, 25,
Round .................................. 46, 47, 48, 49, 73, 74, 75, 76
30, 31, 32, 33, 39, 40, 41, 42, 48, 50, 51, 52, 53, 54,
55, 56, 58, 59, 60, 70, 71, 72
S using System.Reflection ........................ 37, 51, 54
using System.Text.RegularExpressions . 26, 43,
Select .................................. 3, 51, 52, 53, 54, 56, 58, 59 44, 45, 56
Sort ............................................................................... 3
Split ..................................................................... 51, 54
V
Substring .................................................................. 37
Sum ................ 4, 39, 40, 41, 42, 50, 51, 52, 53, 54, 56, 75
value ............................................. 15, 20, 23, 27, 29, 57
var.. 5, 6, 8, 13, 14, 20, 31, 37, 47, 48, 51, 52, 54, 59, 60,
T 61, 62, 70, 74

Take ................................................................. 70, 71, 72


W
this .......................... 3, 23, 24, 25, 26, 27, 28, 29, 47, 73
throw ........................................................................... 60
Where ............................................. 39, 40, 41, 52, 56, 59
ToArray . 2, 12, 13, 14, 30, 31, 32, 33, 57, 58, 59, 60, 61,
while ............................................................... 61, 66, 67
62, 70, 71, 72
ToCharArray ................................................................ 3
ToList ......................................................................... 60 Y
ToString................................................................... 2, 3
ToUpper ..................................................... 23, 24, 25, 26 yield ........................................................................... 58
TrueForAll ................................................................ 24
Tuple ........................................................................... 74

Page 88 of 89

You might also like