### Opposite number

Fundamentals
Code
Diff
• ``````using System;

public class Kata {
public static int Opposite(int n) => -n;
}``````
•  1 1 ```using System; ``` 2 2 3 − ```public class Kata ``` 4 − ``` { ``` 5 − ``` public static int Opposite(int n) ``` 6 − ``` { ``` 7 − ``` return -n; ``` 8 − ``` } ``` 9 − ``` } ``` 3 + ```public class Kata { ``` 4 + ``` public static int Opposite(int n) => -n; ``` 5 + ```} ```

### stɛffan153's Kumite #2546

``console.log("<PASSED::>");``

### My Custom Hello World

Code
Diff
• ``````Solution=_=>"Hello World"
``````
•  1 − ```function Solution() {return "Hello World"} ``` 1 + ```Solution=_=>"Hello World" ```

### Difference of consecutive positive square numbers

Mathematics
Algorithms
Numbers
Code
Diff
• ``powerdistance(x)=2x-1``
•  1 − ```power_distance=lambda x:2*x-1 ``` 1 + ```powerdistance(x)=2x-1 ```

### Difference of consecutive positive square numbers

Mathematics
Algorithms
Numbers
Code
Diff
• ``power_distance=lambda x:2*x-1``
•  1 − ```power_distance = lambda x: 2 * x - 1 ``` 1 + ```power_distance=lambda x:2*x-1 ```

### stɛffan153's Kumite #2531

just messing with you :>

``````module Kumite where

main = do
putStrLn "<DESCRIBE::>Kumite\n<PASSED::>Test Passed\n"
print \$ if if if if if True then True else False then True else False then True else False then True else False then 1 else 0``````

### List of divisors of number

:D

Code
Diff
• ``divisors=lambda n:[x for x in range(1,n+1)if n%x<1]``
•  1 − ```divisors=lambda n:[x for x in range(1,n+1)if n%x==0] ``` 1 + ```divisors=lambda n:[x for x in range(1,n+1)if n%x<1] ```
Failed Tests

### playing with Control.Lens

Control.Lens is mind-bogglingly powerful.
Just playing with this amazing thing.

``````module Kumite where

import Control.Lens

main = do
print \$ (1, 2, 3) ^.. each
print \$ map (^..each) [(1, 2, 3), (4, 5, 6), (7, 8, 9)]
print \$ both ^~ 2 \$ (1,2,3,4)
print \$ mapped._2 %~ succ . (* 2) \$ [(1,2),(3,4)]
print \$ over (mapped._2) succ [(1,2),(3,4)]
print \$ (10,20) ^. _2
print \$ _1 .~ "i changed this" \$ ((), "world")``````

### Find the maximum number

Code
Diff
• ``const findMax = a => Math.max(...a);``
•  1 − ```function find_max(arr){ ``` 2 − ``` maxNum = arr[0]; ``` 3 − ``` arr.forEach((ele)=>{ ``` 4 − ``` if(ele > maxNum){ ``` 5 − ``` maxNum = ele; ``` 6 − ``` } ``` 7 − ``` }) ``` 8 − ``` return maxNum; ``` 9 − ```} ``` 1 + ```const findMax = a => Math.max(...a); ```

### Multiplying Strings

Code
Diff
• ``f=str.__mul__``
•  1 − ```Kata=lambda x,y: x*y ``` 2 − 3 − ```# Alternative: ``` 4 − ```# def Kata(string, num): ``` 5 − ```# return string*num ``` 1 + ```f=str.__mul__ ```

### Find the maximum number

Let's rename the function to `max`.

Code
Diff
• ``#``
•  1 − ```f=max ``` 1 + ```# ```

30

Code
Diff
• ``toiletRolls=(r,d,m)=>r>=d*m/20``
•  1 − ```toilet_rolls=lambda r,d,m:r>=d*m/20 ``` 1 + ```toiletRolls=(r,d,m)=>r>=d*m/20 ```

### Find Billy's Special Number

Fundamentals
Code
Diff
• ``````def find_special(jar, special):
if not isinstance(jar, list) or special not in jar:
return
return [special, *filter(special.__ne__, jar)]``````
•  1 1 ```def find_special(jar, special): ``` 2 − ``` if not isinstance(jar, list) or not isinstance(special, (int, float)) or special not in jar: ``` 3 − ``` return None ``` 4 − ``` jar = jar[:] ``` 5 − ``` jar.remove(special) ``` 6 − ``` jar.insert(0, special) ``` 7 − ``` return jar ``` 2 + ``` if not isinstance(jar, list) or special not in jar: ``` 3 + ``` return ``` 4 + ``` return [special, *filter(special.__ne__, jar)] ```

### Find Billy's Special Number

Fundamentals

Code
Diff
• ``find_special=lambda j,s:[s,*filter(s.__ne__,j)]``
•  1 − ```def find_special(jar, special): ``` 2 − ``` if not isinstance(jar, list) or not isinstance(special, (int, float)) or special not in jar: ``` 3 − ``` return None ``` 4 − ``` jar = jar[:] ``` 5 − ``` jar.remove(special) ``` 6 − ``` jar.insert(0, special) ``` 7 − ``` return jar ``` 1 + ```find_special=lambda j,s:[s,*filter(s.__ne__,j)] ```

### Biggest and Smallest Number

Arrays
Strings
Numbers
Code
Diff
• ``const smallBigNum = (s, a) => typeof s === "string" ? [Math.max(...a = s.match(/\d/g)), Math.min(...a)] : [];``
•  1 − ```def small_big_num(infos): ``` 2 − ``` if isinstance(infos, int): return [] ``` 3 − ``` elif isinstance(infos, str): ``` 4 − ``` infos = [int(i) for i in infos if i.isdigit()] ``` 5 − ``` return [max(infos), min(infos)] ``` 6 − ``` ``` 1 + ```const smallBigNum = (s, a) => typeof s === "string" ? [Math.max(...a = s.match(/\d/g)), Math.min(...a)] : []; ```