India’s Best Job Seekers and Training Platform Forums Data Structure You are given a function getNum() that returns a random number…

  • You are given a function getNum() that returns a random number…

     Akash  updated 11 months, 3 weeks ago 1 Member · 1 Post
  • Akash 

    Administrator
    at

    You are given a function getNum() that returns a random number in the range 1 to 10 million with repetitions. However, it may also return -1 when it no longer provides numbers. Write a function that calls getNum() continuously until it returns -1 (if a repetition, should not store it); as soon as u see -1, stop calling getnum() and print all the numbers seen so far in a sorted way. Condition: You have got very limited memory to work with.

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
KodNest Training New Batch is starting on 02nd November 2020. Attend one week free demo classes.Register Now

New Report

Close