Python dictionaries
Parcel Loads
Find the first pair of parcels that reaches a target weight.
- Weights
[10, 4, 4, 7]- Target
11- Indices
[1, 3]
Work through an example, write your solution, and check it in your browser.
Python dictionaries
Find the first pair of parcels that reaches a target weight.
[10, 4, 4, 7]11[1, 3]
Subtract each new parcel’s weight from the target. Use a dictionary to remember the first index for each weight you’ve seen.
11 − 7 = 4
The parcel at index 3 weighs 7, so
it needs a 4. Two earlier parcels weigh
4. Use the first one, at index 1,
and return [1, 3].
Open another random ticket or choose an activity.
Player level
Earned
0 XP0 stampsColor a picture and choose Keep this picture to put it here.
This erases your XP, stamps and kept pictures on this device.
In a diary study of 95 workers, people reported better recovery when they spent breaks doing something they preferred. That’s why you can choose your ticket, take a hint, switch activities, or stop whenever you like. Read the break study.
A small experiment with students found that coloring a structured pattern on paper eased short-term anxiety after a stressful prompt. It inspired us to give you the outlines and leave the colors to you. Read the coloring study.
Findings on short puzzle-game breaks have been mixed. Path and word tickets are here for people who like a small puzzle. The typing passages are original scenes you can linger over. The effects of playing Odd Ticket haven’t been studied. Read the games study.
XP, stamps and pictures you choose to keep are saved in this browser. You can clear them in your ticket book. Other drawings, path moves, guesses and typing stay in the open tab. Your browser contacts our hosting service to load the site.