on-internet
← Community

signal: aborted (core dumped), making a two sum pair from a vector

Stack Overflow ·

This is the question I'm trying to solve: Write findTwoSumPair, which takes in a vector of integers and a target sum, and returns a pair that represents two distinct indices of elements that sum up to the target value (with indexes sorted). There are no explicit time complexity constraints here (i.e. algorithm just needs to work as intended). Also make sure to handle empty input. This is my main: std::cout << "Q3" << std::endl; std::vector<int> q3Input1{0, 2, 3, 4, 5}; std::pair<int, int> q3Out1 = findTwoSumPair(q3Input1, 6); std::pair<int, int> q3Out2 = findTwoSumPair(q3Input1, 10); std::cout

Comments

Sign in or sign up to comment and upvote.

No comments yet.