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:
C. Am I carrying money?
Explanation:
The options are:
A. Am I awake and alert?
B. Am I emotionally sound?
C. Am I carrying money?
D. Am I physically able?
The correct option is certainly C. Am I carrying money? It can also be a concern if you are worrying since we don't have money. However, here its mentioned, we are not carrying, and it's not like we don't have money, and hence, it is not going to affect our mindset. Hence, it is not an assessment of anybody's fitness to drive.