Ctrl K

Twice as Much

Easy
The list amounts holds the totals of a day's receipts. Check whether two receipts at **different** positions exist where one is exactly twice the other: amounts[i] == 2 * amounts[j] with i != j. Return True if such a pair exists, and False otherwise.
Example 1
amounts=[7, 3, 12, 6] → True

12 is exactly twice 6.

Example 2
amounts=[5, 9, 4, 11] → False

No number is double another one.

Example 3
amounts=[0, 8, 0] → True

Zero is twice zero, and there are two zeros here at different positions.

Constraints
  • 2 ≤ len(amounts) ≤ 500
  • −1000 ≤ amounts[i] ≤ 1000
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsValues in Both Lists EasyShared Values With Repeats EasyPairs With a Fixed Gap MediumSpells Without Neighbors MediumThe Lost Ticket Easy
loading Python…
Input
amounts=[7, 3, 12, 6]
Expected
True

Run checks the first 3 tests in your browser. Submit checks all 131 tests on the server, hidden ones included.