## 30秒学会 Dart 片段 – factorial

Calculates the factorial of an integer.

Use recursion.
If `n` is less than or equal to `1`, return `1`.
Otherwise, return the product of `n` and the factorial of `n-1`.
Throws an exception if `n` is a negative number.

## 30秒学会 Dart 片段 – degreesToRads

Converts an angle from degrees to radians.

Use `pi` and the degree to radian formula to convert the angle from degrees to radians.

## 30秒学会 Dart 片段 – isDivisible

Checks if the first integer argument is divisible by the second one.

Use the modulo operator (`%`) to check if the remainder is equal to `0`.

## 30秒学会 Python 片段 – min_n

Returns the `n` minimum elements from the provided list.
If `n` is greater than or equal to the provided list’s length, then return the original list (sorted in ascending order).

Use `sorted() to sort the list,`[:n]`to get the specified number of elements. Omit the second argument,`n`, to get a one-element list.

## 30秒学会 JavaScript 片段 – sortedLastIndexBy

Returns the highest index at which value should be inserted into array in order to maintain its sort order, based on a provided iterator function.

Check if the array is sorted in descending order (loosely).
Use `Array.prototype.map()` to apply the iterator function to all elements of the array.
Use `Array.prototype.reverse()` and `Array.prototype.findIndex()` to find the appropriate last index where the element should be inserted, based on the provided iterator function.

## 30秒学会 Golang 片段 – IsOdd

Returns `true` if the given number is odd, `false` otherwise.

Checks whether a number is odd or even using the modulo (`%`) operator.
Returns `true` if the number is odd, `false` if the number is even.

## 30秒学会 Dart 片段 – symmetricDifferenceBy

Returns the symmetric difference between two lists, after applying the provided function to each list element of both.

Use `Iterable.toSet()` and `Iterable.map()` to get the unique values in each list after applying `fn` to them.
Use `Iterable.where()` in combination with `Iterable.contains()` to keep only the values in one list and not the other.
Finally, use `Iterable.toList()` and `Iterable.addAll()` in combination with the cascade operator (`..`) to return the result.

## 30秒学会 PHP 片段 – isPrime

Checks if the provided integer is a prime number.

Check numbers from `2` to the square root of the given number.
Return `false` if any of them divides the given number, else return `true`, unless the number is less than `2`.

## 30秒学会 C# 片段 – Fibonacci

Generates an array, containing the Fibonacci sequence, up until the nth term.

Starting with `0` and `1`, loop from `2` through `n` adding the sum of the last two numbers and appending to the sequence.
If `n` is less or equal to `0`, return a list containing `0`.