How to understand the problem is "Apple and Orange" on hackerrank?

Good day!
Reached objectives "Apple and Orange" on hackerrank and entangled in its intricacies.

In the house Sam has an Apple tree and an orange tree that give plenty of fruit. In the diagram below, the red area refers to his house, where s is the starting point and t is the ending point.

Apple is to the left of his house and orange tree on the right.

We can assume that the trees are located at the same point where Apple is at point a, and the orange tree - at the point b.

When the fruit falls from his tree, he lands at a distance d units from his tree along the x-axis.

A negative value of d means that the fruit fell from the tree on the left, and positive d value means that it falls to the right of the tree.

Given the value of d for m apples and n oranges to determine how many apples and oranges will fall on the house of Sam (ie in inclusive range [s,t)?

For example, Sam's house is located between s=7 and t=10. Apple tree is located on a=4, and orange for b=12.

There are m=3 and n Apple=3 oranges.

Apple trees throw apples at [2,3,-4] units distance from a and orange tree throws oranges at [3,-2,-4] distance units.

When adding each distance of the Apple to the position of the tree, they land on [4+2,4+3,4-4]=[6,7,0]

Plot fall on the land of oranges [12+3,12-2,12-4]=[15,10,8]

One Apple and two oranges of the earth in the range of 7-10, so we print

1
2


Where did [2,3,-4] and [3,-2,-4]?
It seems that the task isn't written yet
March 20th 20 at 11:42
1 answer
March 20th 20 at 11:44
Solution
[2,3,-4]:
The first Apple fell on position 2
Second Apple fell on position 3
Third Apple fell to the -4 position

[3,-2,-4]
The first orange fell to position 3
The first orange fell to a position of -2
The first orange fell to the -4 position

Find more questions by tags IT education