CJCoding With Joseph
15free / daySign inCreate account

Two Sum By Brute Force

Write two_sum_brute(values: list[int], target: int) -> tuple[int, int] that returns the indexes (i, j), with i before j, of the first pair of values that add up to target, trying every pair with two nested loops over indexes; return (-1, -1) when no pair works. This is O(n squared). Do NOT write a main block or any top-level test code; the tests construct the calls. Input: two lines, a space-separated list of integers and then the target; the tests print the tuple your function returns.

Expected Output:

(0, 1)

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Data Structures & AlgorithmsBig-O
📥 Auto-Input:
2 7 11 15\n9\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.