Given an integer array nums and an integer k, return true if nums has a continuous subarray of size at least two whose elements sum up to a multiple of k, or false otherwise.

An integer x is a multiple of k if there exists an integer n such that x = n * k. 0 is always a multiple of k.

&nbsp;
Example 1:

Input: nums = [23,2,4,6,7], k = 6
Output: true
Explanation: [2, 4] is a continuous subarray of size 2 whose elements sum up to 6.


Example 2:

Input: nums = [23,2,6,4,7], k = 6
Output: true
Explanation: [23, 2, 6, 4, 7] is an continuous subarray of size 5 whose elements sum up to 42.
42 is a multiple of 6 because 42 = 7 * 6 and 7 is an integer.


Example 3:

Input: nums = [23,2,6,4,7], k = 13
Output: false


&nbsp;
Constraints:


	1 &lt;= nums.length &lt;= 105
	0 &lt;= nums[i] &lt;= 109
	0 &lt;= sum(nums[i]) &lt;= 231 - 1
	1 &lt;= k &lt;= 231 - 1


class Solution:
    def checkSubarraySum(self, nums: List[int], k: int) -> bool:
        psum = {0:-1}
        currentSum = 0
        for i in range(len(nums)):
            currentSum += nums[i]
            remainder = currentSum % k
            if remainder not in psum:
                psum[remainder] = i
            else:
                if i - psum[remainder] > 1:
                    return True
        return False
class Solution {
    public boolean checkSubarraySum(int[] nums, int k) {
        boolean t[]=new boolean[nums.length+1];
        Arrays.fill(t,false);
       return help(nums.length,nums,k,0,0,t);
    }
    public boolean help(int i,int nums[],int k,int sum,int size,boolean t[]){
        if(size>=2&&sum%k==0){
            return true;
        }
        if(i==0){
            return false;
        }
        if(t[i-1]!=false){
            return t[i-1];
        }
        if(size>0){
         return t[i]=help(i-1,nums,k,sum+nums[i-1],size+1,t);
        }
        return t[i]=help(i-1,nums,k,sum+nums[i-1],size+1,t)||help(i-1,nums,k,sum,size,t);
    }
}
---------------------------------------------------------------------------------------------
class Solution {
    public boolean checkSubarraySum(int[] nums, int k) {
      int sum=0;
      HashMap<Integer,Integer>h=new HashMap<>();
      h.put(0,-1);
      for(int i=0;i<nums.length;i++){
          sum+=nums[i];
          sum=k==0?sum:sum%k;
          if(h.containsKey(sum)&& i-h.get(sum)>=2){
              return true;
          }
          h.put(sum,h.getOrDefault(sum,i));
      }  
        return false;
    }
}
class Solution {
public:
    bool checkSubarraySum(vector<int>& nums, int k) {
        unordered_set<int> s;
        int sum = 0;
        int pre = 0;
        for(int i = 0; i < nums.size(); i++)
        {
            sum += nums[i];
            int remainder = sum%k;
            if (s.find(remainder) != s.end())
            {
                return true;
            }
            s.insert(pre);
            pre = remainder;
        }
        return false;
    }
var checkSubarraySum = function(nums, k) {
	const hash = new Map([[0, -1]]);
	let sum = 0;

	for (let index = 0; index < nums.length; index++) {
		sum += nums[index];
		const r = sum % k;

		if (hash.has(r)) {
			if (index - hash.get(r) > 1) return true;
		}
		else hash.set(r, index);
	}
	return false;
};
Continuous Subarray Sum