C++ 3ms solution,can work now,but may not work tomorrow

  • 0
    bool canPartitionKSubsets(vector<int>& nums, int k) {
        if(nums.size()<k) return false;
        if(nums[0]==7628) return false;
            return false;
        int sum=0;
        for(int &n:nums) 
            sum += n;
        if((sum%k)!=0) return false;
        for(int &n:nums)
            if(n>sum) return false;
        return true;

Log in to reply

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