farrukh nadeem wrote:Your observation about 'j' corrected.
Current problems are array reads 4 values only NOT 4 distinct values, output is all ZEROS.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
farrukh nadeem wrote:an array, where duplicates are rejected
Tim Driven Development | Test until the fear goes away
farrukh nadeem wrote:Yes, I know somewhat about SET. Actually, I want to know if I could do it in ARRAY just to get solid understanding of looping.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Winston Gutkowski wrote:Perfectly reasonable. However, your inner loop will still run forever, AFAICS. See if you can work out why.
Regarding fred rosenberger's suggestion of Decomposition
farrukh nadeem wrote:Sorry, I failed to catch your Big Hint: Don't know why the inner loop is asking inputs whereas nextInt code is outside of inner loop. Give me another hint
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
farrukh nadeem wrote:The code is still not fully functional.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
farrukh nadeem wrote:Code has been decomposed as follows although not functioning:
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
farrukh nadeem wrote:Stuck at coding and closed IDE..... probably I should go to learning table again.... would you suggest something I could learn Java systemically ?
farrukh nadeem wrote:I looks I hurt you people out there. I regret I did not meant it.
Actually, I am serious in what I asked in mt previous post, because I am not CS literate and learning at home by working on various book examples.
I feel I always deviate from Winston's advice of WHATnotHOW, my mind always jumps ahead to code the problem, instead of tearing down the problem and make logic of every step to code it.
So, I thought I should learn the "best coding practice" first by following resources available on internet.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |