## The problem

P07 (**) Flatten a nested list structure.

Example:

```scala> flatten(List(List(1, 1), 2, List(3, List(5, 8))))
res0: List[Any] = List(... more

```

## The problem

P06 (*) Find out whether a list is a palindrome.

Example:

```scala> isPalindrome(List(1, 2, 3, 2, 1))
res0: Boolean = true
```

## Initial thoughts

The algorithm is pretty simple. A list is palindrome when it is equal to its reversed version. So both a procedural and a recursive solution may get a reversed version of the list and then compare the two.

For long lists this could be a performance issue, so a ... more

## The problem

P05 (*) Reverse a list.

Example:

```scala> reverse(List(1, 1, 2, 3, 5, 8))
res0: List[Int] = List(8, 5, 3, 2,

... more

```

## The problem

P04 (*) Find the number of elements of a list.

Example:

```scala> length(List(1, 1, 2, 3, 5, 8))
res0: Int = 6
```

## Initial thoughts

This should be straightforward both with object-oriented and functional techniques. There are no special cases except that of an empty list. There is an interesting solution that mixes functional and object-oriented techniques, which is ... more

## The problem

P03 (*) Find the Kth element of a list. By convention, the first element in the list is element 0.

Example:

```scala> nth(2, List(1, 1, 2, 3, 5, 8))
res0: Int = 2
```

## Initial thoughts

I expect the solution to be trivial using the indexing capabilities of `List` types, such as in any language that supports ... more

## The problem

P02 (*) Find the last but one element of a list.

Example:

```scala> penultimate(List(1, 1, 2, 3, 5, 8))
res0: Int = 5
```

## Initial thoughts

This problem come in the same form as the first one, so most of the syntax issues have already been solved. The challenge here is to find a good algorithm to extract the penultimate element and, as done for the first problem, it ... more

## The problem

P01 (*) Find the last element of a list.

Example:

```scala> last(List(1, 1, 2, 3, 5, 8))
res0: Int = 8
```

## Initial thoughts

This is the very first Scala problem, but a lot of topics are covered even by such a small task.

First I have to learn how to define functions. Then the problem shows two data types, namely `List` and `Int`, but it ... more