int arr[3][3] = {
    {1,2,3},
    {4,5,6},
    {7,8,9}
};

arr[행][열]
arr[0][0]은?

arr[1][2]는?

8은 어디 좌표?

방향 배열
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};

범위 체크 연습
int n = 3;
int x = 1, y = 1;

for(int k=0; k<4; k++){
    int nx = x + dx[k];
    int ny = y + dy[k];

    if(nx >= 0 && nx < n && ny >= 0 && ny < n){
        cout << nx << " " << ny << "\n";
    }
}


1️⃣ visited 왜 2차원?

2️⃣ dfs(x,y) 의미?

3️⃣ 왜 재귀?

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: