typestatusdateslugsummarytagscategoryiconpassword创建时间Dec 24, 2024 04:01 AM给你一个整数数组 nums ,设计算法来打乱一个没有重复元素的数组。打乱后,数组的所有排列应该是 等可能 的。实现 Solution class:Solution(int[] nums) 使用整数数组 nums 初始化对象int[] reset() 重设数组到它的初始状态并返回int[] shuffle() 返回数组随机打乱后的结果https://leetcode.cn/problems/shuffle-an-array/description/遍历数组,将数组的当前元素与后续位置的元素随机调换。📎 参考无