[프로그래머스/JavaScript] Lv2. 게임 맵 최단거리
프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr const BFS = (start, arr, target) => { let move = 1; const dx = [-1, 1, 0, 0]; const dy = [0, 0, -1, 1]; const n = arr.length; const m = arr[0].length; const visited = Array.from({ length: n }, () => Array(m).fill(false)); // 방문 체크 visited[start[0]][start[1]] = true; // 시작 지점 방문 처리 ..
2025. 3. 4.
[Next.js + Naver Map API] 네이버 지도 api 사용하기ㅣ현재 위치, 주소 가져오기, 마커 표시하기
➜ Next.js 에서 네이버 지도 api 사용해서 지도 그리기 - 현재 위치 좌표 가져오기, 좌표로 주소 데이터 가져오기, 특정 좌표에 마커 표시하기 지도 그리기 const mapRef = useRef(null);useEffect(() => { // 지도 그리기 if (!mapRef.current) { mapRef.current = new naver.maps.Map(mapId, { center: new naver.maps.LatLng(loc[0], loc[1]), zoom: initMapLevel, minZoom: 7, }); } }, []); return ( ); 1. useRef로 NaverMa..
2025. 2. 17.