C++ solution (Why is this a Medium problem ?)

  • 0
    class Solution {
        vector<int> original;
        vector<int> shuffled;
        Solution(vector<int> nums) {
            original = nums;
            shuffled = nums;
        /** Resets the array to its original configuration and return it. */
        vector<int> reset() {
            return original;    
        /** Returns a random shuffling of the array. */
        vector<int> shuffle() {
            random_shuffle(shuffled.begin(), shuffled.end());
            return shuffled;

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.