HackerEarth Diamonds problem solution YASH PAL, 31 July 2024 In this HackerEarth Diamonds problem solution, Roman loved diamonds. Monica decided to give him a beautiful gift on Valentine’s Day. Her idea of diamonds was different though. She lit up all the windows of her rectangular building with N floors and M windows on each floor, with 2 shapes – / or . According to her, a diamond was made when such a shape was created: / / we have Given the shape of lights in all the windows, help Roman count the number of diamonds formed. Note: The components of the diamond should be adjacent to each other. HackerEarth Diamonds problem solution. #include <bits/stdc++.h>using namespace std;char a[1024][1024];int main() { int t;cin>>t; while(t--) { int n,m; cin>>n>>m; assert(n>=2 && n<=1000); assert(m>=2 && m<=1000); for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { cin>>a[i][j]; } } int cnt=0; for(int i=0;i<n-1;i++) { for(int j=0;j<m-1;j++) { if(a[i][j]=='/' && a[i][j+1]=='\' && a[i+1][j]=='\' && a[i+1][j+1]=='/') { cnt++; } } } cout<<cnt<<"n"; }} coding problems