Can someone please explain how in the attached are variables being called with reference to a open array? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Can someone please explain how in the attached are variables being called with reference to a open array?

Examples include: points[count], points[i]. Shouldn't index numbers be used to call values in an array? I am missing a concept here which apparently hasn't been covered by Sololearn https://code.sololearn.com/W16t7Cfwv85l/?ref=app

13th Nov 2021, 12:19 AM
Mohammed Qaif Gaffar
1 Respuesta
0
Your code is fine I just completed this practice, to understand what is this code about. You recive 1 input at the time using readLine() So for first test case 3 1 4 8 are inputs. First is number of passed levels, all other inputs (points per level) are passed to elem array one at the time(because you call readLine inside while loop, it will continue to read next line), so elem will have [1,4,8] when you sum output is 13
13th Nov 2021, 12:45 AM
PanicS
PanicS - avatar