編程高手請進
Please implement the function
int isLetter(int n);
Allowed operators: <, &.
Parentheses are allowed without limit.
No looping or if statements are allowed.
No looping or if statements are allowed.
Please minimize the number of operations for efficiency. 最少可以幾次使用以上算符?
examples of output:
isLetter(10) = 0, isLetter('&') = 0,
isLetter('A') = 1, isLetter('m') = 1, isLetter(68) = 1 (68 is ascii code for 'D').
isLetter('A') = 1, isLetter('m') = 1, isLetter(68) = 1 (68 is ascii code for 'D').
Hint:
1. logical true = 1, logical false = 0. for example (3 > 1) = 1, (3 < 1) = 0.
2. The binary and ascii values for letters are like:
a | 097 | 01100001 | A | 065 | 01000001 |
b | 098 | 01100010 | B | 066 | 01000010 |
c | 099 | 01100011 | C | 067 | 01000011 |
d | 100 | 01100100 | D | 068 | 01000100 |
e | 101 | 01100101 | E | 069 | 01000101 |