In this post, we will solve **Update List HackerRank Solution**. This problem **(Update List)** is a part of **HackerRank Functional Programming** language.

**Task**

Update the values of a list with their absolute values. The input and output portions will be handled automatically during grading. You only need to write a function with the recommended method signature.

**Input Format**

There areÂ * N*Â integers, each on a separate line. These are theÂ

*Â elements of the input array.*

**N****Output Format**

Output the absolute value ofÂ * N*Â integers, each on a separate line in the same input order.

**Sample Input**

```
2
-4
3
-1
23
-4
-54
```

**Sample Output**

```
2
4
3
1
23
4
54
```

**Constraints**

- The list will have no more thanÂ
**100**Â integers. - Each integer,Â
, in the list:**X****Â -100 <= X <= 100**.

**Recommended Method Signature**

```
Number Of Parameters: 1
Parameters: [list]
Returns: List or Vector
```

**For Hackers Using Clojure**

This will be the outline of your function body (fill in the blank portion marked by underscores):

`(fn[lst]___________________________)`

**For Hackers Using Scala**

This will be the outline of your function body (fill in the blank portion marked by underscores):

` def f(arr:List[Int]):List[Int] = __________________`

**For Hackers Using Haskell**

This will be the outline of your function body (fill in the blank portion marked by underscores):

`f arr = ___________________`

**For Hackers Using other Languages**

You have to read input from standard input and write output to standard output. Please follow the input/output format mentioned above.

**NOTE**: You only need to submit the code above after filling in the blanks appropriately. The input and output section will be handled by us. The focus is on writing the correct function.

**Solution – Update List – HackerRank Solution**

**Scala**

def f(arr: List[Int]): List[Int] = arr.map(math.abs)

**Note: **This problem **(Update List)** is generated by **HackerRank** but the solution is provided by **CodingBroz**. This tutorial is only for **Educational** and **Learning** purpose.