Answer:
You can simplify the problem down by recognizing that you just need to keep track of the integers you've seen in array that your given. You also need to account for edge cases for when the array is empty or the value you get would be greater than your max allowed value. Finally, you need to ensure O(n) complexity, you can't keep looping for every value you come across. This is where the boolean array comes in handy. See below -
public static int solution(int[] A)
{
int min = 1;
int max = 100000;
boolean[] vals = new boolean[max+1];
if(A.length == 0)
return min;
//mark the vals array with the integers we have seen in the A[]
for(int i = 0; i < A.length; i++)
{
if(A[i] < max + 1)
vals[A[i]] = true;
}
//start at our min val and loop until we come across a value we have not seen in A[]
for (int i = 1; i < max; i++)
{
if(vals[i] && min == i)
min++;
else if(!vals[i])
break;
}
if(min > max)
return max;
return min;
}
Answer: OSI system is called Open System Interconnection because It provides the collection of protocols for the connection of different system to connect with any dependence on any other system or network.
Explanation: Open system interconnection establishes a connection between the different system for the communication purpose using several protocols and software standards .It has no dependency or any network or other system to do the functioning and works using the seven layers of the OSI architecture.Thus, that is why OSI system known as open system.
Answer:
$751
Explanation:
From the question we have the following information;
Gross income = $1000.00
Deductions = $294.00
Now we know that;
Net income = Gross income - Deductions
Therefore;
Net income = $1000.00 - $294.00
Net income = $751
Answer:
B. Which customer most frequently purchases bread.
Explanation:
As per the scenario, the data we are receiving from the sales record of the bakery is :
The date on which the items are sold
Each items name which are sold
The number of each item sold and
The price of each item sold
These data are required to estimate how much the company has earned the profit during a given period of time.
So from the above scenario, there is no data given about the customer i.e customer name, customer number, etc. So there is no chance to track the details of a customer purchase history.
Therefore, the most appropriate answer is option B