Skip to content

Instantly share code, notes, and snippets.

View Anower77's full-sized avatar
🏠
Working from home

Anower Hossain Anower77

🏠
Working from home
View GitHub Profile
@Anower77
Anower77 / 3D_Grid_DFS.cpp
Last active February 15, 2024 11:48
DFS on 3D Grid Implementation
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 20; // Maximum dimensions for the 3D grid
char a[MAX_N][MAX_N][MAX_N]; // 3D grid matrix
bool vis[MAX_N][MAX_N][MAX_N]; // 3D visited matrix
int n, m, p; // Dimensions of the 3D grid
vector<tuple<int, int, int>> d = {{0,1,0},{0,-1,0},{-1,0,0},{1,0,0},{0,0,1},{0,0,-1}}; // 3D directions
@Anower77
Anower77 / c++
Created December 24, 2023 16:02
Goals of Victory
#include<bits/stdc++.h>
using namespace std;
int main() {
int t;cin>>t;
while (t--)
{
int n,sum=0;cin>>n;
vector<int>v(n-1);
for(int i=0;i<n-1;i++)