且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用java中的索引交换数字不起作用

更新时间:2023-01-22 22:00:48

你的错误是假设 c [x] == p c [y] == c0 。但索引 x y 派生自 immutable 字符串 s ,它不会反映其洗牌状态下 c 中的值。

Your mistake is assuming c[x] == p and c[y] == c0. But the indexes x and y are derived from the immutable string s, which doesn't reflect the values in c in its shuffled state.