- #1
ineedhelpnow
- 651
- 0
I was given this problem a while ago to complete as a bonus but I wasn't able to do it. I just came across it and would like to know how it should be done.
Given an integer vector "vi" that is already sorted in ascending order (all elements of the vector are positive), write a function that returns the first found pair of elements whose product equals to a constant "Product". For example, if PRODUCT is 32 the product has:
2 4 6 8 13 15
The function should identify 4 and 8 as the pair.
Define your function appropriately so that both values will be passed back to the caller of the function. However, you are not required to implement the function call.
Given an integer vector "vi" that is already sorted in ascending order (all elements of the vector are positive), write a function that returns the first found pair of elements whose product equals to a constant "Product". For example, if PRODUCT is 32 the product has:
2 4 6 8 13 15
The function should identify 4 and 8 as the pair.
Define your function appropriately so that both values will be passed back to the caller of the function. However, you are not required to implement the function call.