Giter Club home page Giter Club logo

Comments (2)

ndb796 avatar ndb796 commented on September 16, 2024

안녕하세요, azurealstn 님!

dx와 dy 리스트는 함께 사용되며 차례대로 상, 하, 좌, 우의 방향을 의미하는 정보를 담고 있습니다.

일반적으로 문제에서 2차원 공간이 제시되면, 이는 수학의 행렬(Matrix)과 유사한 의미를 가지는 경우가 많습니다.

image

이때 특정한 위치(x, y)를 기준으로 하여 상, 하, 좌, 우의 방향 벡터를 각각 나타내면 다음과 같습니다.

: (-1, 0)
: (1, 0)
: (0, -1)
: (0, 1)

그래서 만약 다음 위치를 결정하고자 할 때, 상(위쪽) 방향으로 가고자 한다면 다음과 같이 nx, ny 값이 대입됩니다.

nx = x + dx[0]
ny = y + dy[0]

다시 말해 nx에는 x - 1이, ny에는 y 값이 그대로 대입되는 형태입니다. 이는 행렬 상에서 현재 위치에서 위쪽으로 이동하는 것과 같다고 볼 수 있습니다. 혹시 아직 이해가 안 가시는 부분이 있으시다면 편하게 말씀해주세요!

감사합니다.
나동빈 드림

from python-for-coding-test.

azurealstn avatar azurealstn commented on September 16, 2024

이제 이해갔습니다!
자세한 설명 감사합니다.

from python-for-coding-test.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.