Question: in C++ Write the function named pivot that will take a vector of integers and return the pivotValue. pivotValue is defined as the index such
in C++
Write the function named pivot that will take a vector of integers and return the pivotValue. pivotValue is defined as the index such that sum of all numbers v[O..pivot] equals the sum of all numbers v[pivot+1 ... end). If there is no pivotValue, return -1 Example-1: pivotValue for {1, 8, 2, 4, 2, 9, 4} is 3 since 1+8+2+4 equals 2+9+4 Example-2: pivotValue for {1, 8, 2} is -1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
