Skip to content

Instantly share code, notes, and snippets.

@shricodev
Last active March 19, 2025 08:04
Show Gist options
  • Select an option

  • Save shricodev/0d7bb5f8b50d08996123ff741c802d3e to your computer and use it in GitHub Desktop.

Select an option

Save shricodev/0d7bb5f8b50d08996123ff741c802d3e to your computer and use it in GitHub Desktop.

Let's break down the apple and pear transactions step-by-step:

  1. Start: 14 apples
  2. Emma takes 3, gives back 2: 14 - 3 + 2 = 13 apples
  3. Drop 7, pick up 4: 13 - 7 + 4 = 10 apples
  4. Leo takes 4, gives 5: 10 - 4 + 5 = 11 apples
  5. Take 1 from Emma: 11 + 1 = 12 apples (Emma has 3-2=1 apple, we take 1, leaving Emma with 0)
  6. Trade 1 to Leo for 3: 12 - 1 + 3 = 14 apples (Leo now has 4-3+1=2)
  7. Give 3 to Emma: 14 - 3 = 11 apples (Emma has 0+3=3)
  8. Emma gives 1 apple and 1 orange: 11 + 1 = 12 apples, 1 orange
  9. Zara takes apple, gives pear: 12 - 1 + 1 = 12 apples, 1 orange, 1 pear
  10. Trade pear for apple: 12 + 1 = 13 apples, 1 orange, 0 pears (Leo gets the pear)
  11. Zara trades apple for orange: 13 + 1= 14 apples, 0 orange
  12. Zara swaps apple for apple: 14 apples, 0 orange

Therefore, you have 0 pears.

@shricodev
Copy link
Copy Markdown
Author

Prompt:

You start with 14 apples. Emma takes 3 but gives back 2. You drop 7 and pick up 4. Leo takes 4 and gives 5.

You take 1 apple from Emma and trade it with Leo for 3 apples, then give those 3 to Emma, who hands you an apple and an orange.

Zara takes your apple and gives you a pear. You trade the pear with Leo for an apple. Later, Zara trades an apple for an orange and swaps it with you for another apple.

How many pears do you have? Answer me just what is asked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment