作者:今生绝恋2702934494 | 来源:互联网 | 2023-10-11 18:36
Ihaveatwodimensionalarrayofletters.Anylettercanvaryaccordingtoacertainalphabet.Iwa
I have a two dimensional array of letters. Any letter can vary according to a certain alphabet. I want to make a unique key for this array according to the letters and its position. For example, if the array is 3 * 3 and the alphabet is {0, a, b, c, *}, the array can be in the form like:
我有一个二维数组的字母。任何字母都可以根据某个字母表而有所不同。我想根据字母及其位置为这个数组制作一个唯一的键。例如,如果数组是3 * 3且字母表是{0,a,b,c,*},则数组的形式可以是:
0 b c
b * a
a a 0
I have tried Key = sum(code(letter)*(r*3+c))
for all r and c, where r and c are the row and the column, but it still gives me the same key for different array forms.
我已经尝试了所有r和c的Key = sum(代码(字母)*(r * 3 + c)),其中r和c是行和列,但它仍然为我提供了不同数组形式的相同键。
What do I miss?
我错过了什么?
P.S. code(letter)
is a mapping function to convert the letter into a value.
附: code(letter)是一个将字母转换为值的映射函数。
1 个解决方案