1. ## ABC problems

question:

A to Z is a circle, if i start from T ,then want go to F, i want to choose a shorest part. how can i do it .
T>U>V>W>X>W>Z>A>B>C>D>E>F = 12
T>S>R>Q>P>O>N>M>L>K>J>I>H>G>F =14

2. Find the difference. If the answer is a positive number, go left; if it is negative, go right. Notice that at the middle of the alphabet the distance is the same in either direction.

Code:
```int path = target letter - start position;
if ( path != abs(path) )
go_right();
else
go_left();```

3. how can i present in C?
i dont understand go right or left

4. Go right. A -> B
Go left. A <- Z

In otherwords, right is counter++, left is counter--, if you're simply walking through your alphabet. Type all the letters in a line. A is on your left. Z is on your right.

Quzah.

5. I'm not going to give you C code while trying to explain an algorithm.

Unfold your circle for a minute in your head. Imagine the series A to Z like so
[A, B, C, D, E, ... Z]
For any given letter, say T, going to letter F, you have two possible directions right or left. By finding the difference between the characters themselves, you can determine which direction would be the shortest path.

If F is at position 5, and T is at position 18
5 - 18 = -13, so if you went to the right direction you would be there after 12 steps.
But notice I also said that in the middle of the alphabet the distance is the same.

From A to M is 13 steps.
From B to N is 13 steps.
From C to O is 13 steps.
.
.
.
See the pattern?

6. Originally Posted by citizen
I'm not going to give you C code while trying to explain an algorithm.

Unfold your circle for a minute in your head. Imagine the series A to Z like so
[A, B, C, D, E, ... Z]
For any given letter, say T, going to letter F, you have two possible directions right or left. By finding the difference between the characters themselves, you can determine which direction would be the shortest path.

If F is at position 5, and T is at position 18
5 - 18 = -13, so if you went to the right direction you would be there after 12 steps.
But notice I also said that in the middle of the alphabet the distance is the same.

From A to M is 13 steps.
From B to N is 13 steps.
From C to O is 13 steps.
.
.
.
See the pattern?
if i go from T to F , then 18-5 = 13. how come give different?

7. It's quite simple, if the answer is >13, you should have gone the other way.
There are only two answers, and it costs the same to work out either one.