What do the red and green apples do?

There's a tree next to my house with a sign "StreetPass Tree". Over time, it's grown lots of red apples and a few green ones. What does each type of apple do? Also, when is a new apple added to the tree?


Solution 1:

For every Shadow Link you encounter, one additional apple will grow on the tree, up to a maximum of twenty apples. Green apples are rarer. Red apples will restore one heart, while green apples will restore three. Apples can be consumed off the ground, or stored in a bottle for later use -- use the net to scoop them up.

Apples can be retrieved after knocking them out of the tree with the Pegasus Boots.