Question 12

There are numbers in between 0-9999999999 (10-digits) which are assigned someone (does not matter which number assigned who)
Write two methods called “getNumber” and “requestNumber” as follows
Number getNumber();
boolean requestNumber(Number number);
getNumber method should find out a number that did not assigned than marks it as assigned and return that number.
requestNumber method checks the number is assigned or not. If it is assigned returns false, else marks it as assigned and return true.
Design a data sturucture to keep those numbers and implement those methods.

New Report