G***n 发帖数: 877 | 1 input: any string
output: 256 bit long int to represent that string,
such that no two different strings perform the
same output. For example, input "ab" and "ba" are
mapped into different long int.
想了很久觉得好像不可能,不知道是不是我太菜鸟了。还是题目有问题。 |
v*****u 发帖数: 1796 | 2 agree with you.
there are obviously more than 2^256 strings
【在 G***n 的大作中提到】 : input: any string : output: 256 bit long int to represent that string, : such that no two different strings perform the : same output. For example, input "ab" and "ba" are : mapped into different long int. : 想了很久觉得好像不可能,不知道是不是我太菜鸟了。还是题目有问题。
|
e***l 发帖数: 710 | 3 不是考精确算法,想想MD5...
另外2^256这个数字已经没有实际意义了 |
n********y 发帖数: 66 | 4 这不可能。
如果真能做到,研究压缩算法的都能回家带孩子去了。。
such that in most cases, two .....
这个,利用加密解密常用的 modulo arithmetic 应该靠谱一些。。 |
G***n 发帖数: 877 | 5 sorry, sorry,I think the input is any string with the size at 10KB. |
g***s 发帖数: 3811 | 6 i think the interviewer was asking you to write a hashCode function for
string
【 在 Geman (Geman) 的大作中提到: 】 |