Brute Force Implementation ( Time Complexity : O ( N ^ 3 ) ) C ++ program to find count of subsequences of size three divisible by M .
#include <bits/stdc++.h> NEW_LINE using namespace std ; int coutSubSeq ( int A [ ] , int N , int M ) { int sum = 0 ; int ans = 0 ;