Invert values
Description: Given a set of numbers, return the additive inverse of each. Each positive becomes negatives, and the negatives become positives. invert([1,2,3,4,5]) == [-1,-2,-3,-4,-5] invert([1,-2,3,-4,5]) == [-1,2,-3,4,-5] invert([]) == [] You can assume that all values are integers. Do not mutate the input array/list. Solution: 1. Get the numbers in the array. 2. Change positive numbers to nega..
2022. 3. 27.
Multiplication table
Description: Your task, is to create NxN multiplication table, of size provided in parameter. for example, when given size is 3: 1 2 3 2 4 6 3 6 9 for given example, the return value should be: [[1,2,3],[2,4,6],[3,6,9]] Solution: 1. Use the for statement twice to create a two-dimensional array. 2. The numbers in the given array are added in the second for statement. 3. Returns the numbers in a t..
2022. 3. 19.