본문 바로가기

전체 글50

서울에 위치한 식당 목록 출력하기 - 프로그래머스 문제 REST_INFO, REST_REVIEW 테이블을 JOIN 하여 풀면 되는 문제입니다. 주의할 점은... 서울!! 서울에 위치한 식당들만 찾습니다. 처음에 이거 때문에 계속 해멧네요 ㅜㅜ -- 코드를 입력하세요 SELECT A.REST_ID, A.REST_NAME, A.FOOD_TYPE, A.FAVORITES, A.ADDRESS, ROUND(AVG(B.REVIEW_SCORE),2) AS SCORE FROM REST_INFO AS A JOIN REST_REVIEW AS B ON A.REST_ID = B.REST_ID GROUP BY A.REST_ID HAVING A.ADDRESS LIKE '서울%' ORDER BY AVG(B.REVIEW_SCORE) DESC, A.FAVORITES DESC 2023. 2. 8.
904. Fruit Into Baskets 904. Fruit Into Baskets Medium You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array fruits where fruits[i] is the type of fruit the ith tree produces. You want to collect as much fruit as possible. However, the owner has some strict rules that you must follow: You only have two baskets, and each basket can only ho.. 2023. 2. 7.
1091. Shortest Path in Binary Matrix 1091. Shortest Path in Binary Matrix Medium Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1. A clear path in a binary matrix is a path from the top-left cell (i.e., (0, 0)) to the bottom-right cell (i.e., (n - 1, n - 1)) such that: All the visited cells of the path are 0. All the adjacent cells of the path are 8-.. 2023. 2. 6.
2091. Removing Minimum and Maximum From Array 2091. Removing Minimum and Maximum From Array Medium You are given a 0-indexed array of distinct integers nums. There is an element in nums that has the lowest value and an element that has the highest value. We call them the minimum and maximum respectively. Your goal is to remove both these elements from the array. A deletion is defined as either removing an element from the front of the array.. 2023. 2. 1.
Pomodoro - TS, React, Tailwind CSS 이번에 frontend mento 사이트에서 간단한 타이머를 만들어 봤습니다. 사용한 기술 스택 typescript react tailwind css headlessui react-countdown-circle-timer 구현 사항 1. 반응형 (모바일, 태블릿, pc) 2. 타이머 3. 환경 설정 모달 4. 시간, 폰트, 색깔 설정 1. 반응형 구현 tailwind css를 사용하면 반응형 디자인을 쉽게 구현할 수 있기 때문에 tailwind css를 사용했습니다. 필요한 색깔, 폰트, 사이즈 등을 tailwind.config에 세팅해 줍니다. 2. 타이머 구현 타이머 구현은 react-countdown-circle-timer 라이브러리를 사용해서 구현하였습니다. 3. 환경 설정 모달 및 홈 화면 탭바.. 2023. 1. 2.
모던 자바스크립트 Deep Dive - 프로미스 콜백 함수 콜백 함수는 ES6이전에 비동기 처를 위해 사용하던 하나의 패턴이지만, 다음과 같은 단점들이 있어 ES6에서 프로미스 패턴이 도입된다. 1. 콜백 헬로 인해 가독성이 나쁘다. 비동기 처리 결과를 가지고 또다시 비동기 함수를 호출하여 콜백 함수 호출이 중첩되어 복잡도가 높아지는 현상 let g = 0 setTimeout(() => {g = 100;},0) console.log(g) // 0 위의 코드에서 처럼 비동기 처리 결과를 변수에 할당하려고 하면 기대한 대로 동작하지 않는다. setTimeout은 실행후 브라우저에서 타이머가 만료되면 콜백 함수를 태스크 큐로 이동한다, 그리고 콜 스택이 비어 있으면, 이때 태스크 큐에서 콜스택으로 이동하고 콜백함수가 실행된다. 그렇기 때문에 g = 100 .. 2022. 12. 31.