My straightforward C++ solution


  • 1
    B
    class Solution {
    public:
        Solution(vector<int> nums) :re_input(nums),input(nums){
        }
        
        /** Resets the array to its original configuration and return it. */
        vector<int> reset() {
            return re_input;
        }
        
        /** Returns a random shuffling of the array. */
        vector<int> shuffle() {
            random_shuffle(input.begin(),input.end());
            return input;
        }
        vector<int>input;
        vector<int>re_input;
    };
    

Log in to reply
 

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