Answer:
See explaination
Explanation:
Keep two iterators, i (for nuts array) and j (for bolts array).
while(i < n and j < n) {
if nuts[i] == bolts[j] {
We have a case where sizes match, output/return
}
else if nuts[i] < bolts[j] {
this means that size of nut is smaller than that of bolt and we should go to the next bigger nut, i.e., i+=1
}
else {
this means that size of bolt is smaller than that of nut and we should go to the next bigger bolt, i.e., j+=1
}
}
Since we go to each index in both the array only once, the algorithm take O(n) time.
Answer:
x = int(input("What grade are you in? "))
if (x == 9):
print ("Freshman")
elif (x == 10):
print("Sophomore")
elif (x == 11):
print ("Junior")
elif (x == 12):
print("Senior")
else:
print ("Not in High School")
Explanation:
Answer:
see shawty problem is, I havent had that phase yet, my cousin would be able to answer this tho
Answer:
c
Explanation:
king had eaten when Airah called
Answer:
toString is right Answer
Explanation:
If you want to represent any object as a string, toString() method comes into existence.
The toString() method returns the string representation of the object.
If you print any object, java compiler internally invokes the toString() method on the object. So overriding the toString() method, returns the desired output, it can be the state of an object etc. depends on your implementation.