Hi Guys, i kind of hit a road block while doing practice questions in code wars
1. I have a doubleArray which contains distances
val x:DoubleArray = doubleArrayOf(0.0, 0.19, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25)
the values are records every 1.5s distance travelled, in this case 0.0 is the starting point 0.19 is when the distance covered is recorded at 1.5 seconds mark after another 1.5 seconds the distance of 0.5 is recorded and so on.
2. I need to find the difference in distances as following
0.0-0.19, 0.19-0.5, 0.5-0.75, 0.75-1.0, 1.0-1.25, 1.25-1.50, 1.5-1.75, 1.75-2.0, 2.0-2.25
, i know how to use map(to double values or multiple then) but i don't know how to subtract from a preceded value with a previous value in an Array
3. you can refer to the full question if my explanation is not clear, i just need to find the difference in distances before i can proceed to do the next step, hope someone can help me on this 😅