Java Challenge question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 26

Java Challenge question

Can anyone explain me how the ans is 51? I lost in java Challenge. https://code.sololearn.com/cb1bkBG4VG8U/?ref=app

27th Aug 2020, 7:06 PM
Lamya😉
Lamya😉 - avatar
11 Answers
+ 23
~ swim ~ JaScript yeah i forgot that logic, actually i was iterating a loop again and again to check all the combinations of ans and finally i got confused.
27th Aug 2020, 7:43 PM
Lamya😉
Lamya😉 - avatar
+ 18
Eshan Khan here is the java course on sololearn https://www.sololearn.com/Course/Java/?ref=app
29th Aug 2020, 12:42 PM
Lamya😉
Lamya😉 - avatar
+ 14
Netha_r2071 yeah i got your point 👍
29th Aug 2020, 3:51 PM
Lamya😉
Lamya😉 - avatar
+ 5
pix[ind]=i+j; and with the for loop 150 = i + j*100 that means shall be j = 1 and i = 50 pix[150]=i+j = 51
27th Aug 2020, 7:34 PM
JaScript
JaScript - avatar
+ 4
And I thought it was returning garbage value, at 5100 it returns 51, and for index 20 it returns 20
27th Aug 2020, 7:24 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 3
Lamya I + j = value I + j * 100 = index I => 50 j => 1 I + j => 51 ind => I + j * 100 => 150 It concludes that pix[ind] = 51 Any doubt, don't think about how array is getting filled. DHANANJAY PATEL
29th Aug 2020, 5:12 AM
DHANANJAY PATEL
DHANANJAY PATEL - avatar
+ 2
~ swim ~ Thank you !!! It's for earning or participation only !!! I am earning my bage, I had earned during past life. That's why I am working on SoloLearn. Please, don't mind on my coment it's for the sack of future projects. It is for well being. Be Good Citizen.
29th Aug 2020, 1:09 PM
DHANANJAY PATEL
DHANANJAY PATEL - avatar
+ 2
~ swim ~ Leaving this kind of thread. DHANANJAY PATEL
29th Aug 2020, 1:24 PM
DHANANJAY PATEL
DHANANJAY PATEL - avatar
+ 2
Lamya😉 ["非活性"] there is no difficulty, when i=50 and j=1,we get pix[ind]=51. Just to get a clear idea to u, just cross check the values of pix[ind]=50,for i=50 and j=0,just understand the logic, hope this helped :)
29th Aug 2020, 2:48 PM
RuntimeERROR
RuntimeERROR - avatar
0
How to learn java on sololearn
29th Aug 2020, 12:21 PM
Eshan Khan
Eshan Khan - avatar
0
In depth knowledge is required in makers and bussy points. Bye for now. I am with Davis it's ancient and non ethnic person name. Slow and study needs remarkable work. Disappointment is there two.
13th Sep 2021, 3:33 PM
DHANANJAY PATEL
DHANANJAY PATEL - avatar