Modern computers use binary, with only 0 and 1 symbols:

(1) One represents truth and one represents falsehood;

(2) There is only one relation between two symbols, which is called 1+1=0;

1, 2, 4, 8, 16 can represent all numbers between [0, N], where N=1+2+4+8+16=31.

Just as the weight can only be placed on one side of the scale to weigh anything between 1 and 31. Such as:

Weight 11 = 1 + 2 + 8

Weight 12 = 4 + 8

Weight 13 = 1 + 4 + 8

The weight of 14 = 2 + 4 + 8

But in fact, ternary -1, 0, 1 is closer to how the human brain works:

(1) In addition to true and false, there can also be a symbol for not knowing;

Voice-over: Like a scale of light, heavy, flat three values.

(2) There are two kinds of relations between symbols, in addition to the relation “+”, there is a relation “-“;

Like the scales of the scales, with m and N (m> N) two weights, they can weigh not only m+n, but also m-N.

1, 3, 9, 27 can represent all numbers between [0, N], where N=1+3+9+27=40.

Such as:

11 = 3 + 9-1 in weight

Weight 12 = 3 + 9

Weight 13 = 1 + 3 + 9

The weight of 14 = 27-9-3

Q: How many weights does a scale need to weigh from 1 to 40?

A: Four weights 1, 3, 9, 27 can weigh the 40 weights from 1 to 40.

Today, we have collected: 2020 Internet Big factory real interview questions, mainly: Ant Financial, Pinduoduo, Ali Cloud, Baidu, Vipshop, Ctrip, Fengchao Technology, Lexin, Isoftstone, OPPO, Yinsheng payment, Ping an of China and other primary, intermediate, advanced Java interview questions set.