분류 전체보기
-
[프로그래머스 1단계] 신고 결과 받기알고리즘 2024. 1. 29. 18:54
❓문제 설명 신고한 array와 신고 내용에 대한 array가 있고 limit을 나타내는 k가 있다 이러쿵 저러쿵해서 A를 신고한 B는 A가 k이상의 신고를 받게 되면 A가 정지가 되었다는 알림을 받는 것임 최종적으로 사용자들이 몇번이나 알림을 받는지 array를 반환하는 것임 테스트 코드는 통과하였지만 제출할 때 정답률 60%로 나오는데 왜 이러는걸까? - 느낀점 1 ✅ 문제 해결 배열을 value로 가지고 key는 reportedUser인 객체 하나를 만들어서 배열에 신고한 reportUser를 넣을 것임 결국 신고를 받은 유저의 배열의 길이가 2이상이면 그 배열 안을 돌면서 값을 올려주면 되는 것임 function solution(id_list, report, k) { const answer = n..
-
[CS Study] 프레임워크와 라이브러리네트워크/CS Study 2024. 1. 26. 18:40
프레임워크 개발자가 소프트웨어를 개발함에 있어 코드를 구현하는 시간을 줄이고 재사용성을 증가시키기위한 일련의 클래스 묶음이나 뼈대, 기반구조라 불리며 제어의 역전 개념이 적용된 대표적 기술이다. 소프트웨어의 특정 문제를 해결하기 위해서 상호 협력하는 클래스와 인터페이스의 집합이다. 특징 개발할 수 있는 범위가 정해져 있고 개발자는 이러한 따라야하는 가이드를 제공 받는다. 프레임워크는 다양한 도구 및 플러그인을 제공한다. 특정 개념들의 추상화를 제공하는 여러 클래스나 컴포넌트로 구성되어 있어 추상적인 개념들이 문제를 해결하기 위해 같이 작업하는 방법을 정의한다. 컴포넌트의 재사용이 가능하며 높은 수준에서 패턴들을 조작화할 수 있다. 예시 Django, Ruby, React Native, Flutter, A..
-
[프로그래머스 1단계] 성격 유형 검사하기알고리즘 2024. 1. 26. 16:18
❓문제 설명 length가 2인 문자열로 이루어진 배열을 줄 것임 숫자로 이루어진 동일한 length의 배열도 하나 줄 것임 두개를 짬뽕해서 어쩌구저쩌구 해서 문자 하나만 뽑으셈 사실 MBTI였음 이때까지 나온거 합쳐서 length가 4인 문자열 하나 출력해보셈 function solution(survey, choices) { const types = {} const answer = [] "RTCFJMAN".split("").map(item => types[item] = 0) const newChoices = choices.map(item => item - 4) for (item of survey) { const [left, right] = item.split("") const index = survey..
-
[React] 고차 컴포넌트 (HOC, High Order Component)프로그래밍/React 2024. 1. 20. 16:09
고차 컴포넌트 하나의 개발 패턴으로 컴포넌트를 인자로 받아서 새로운 컴포넌트로 변환해 반환하는 방식으로 인자로 넘긴 컴포넌트에게 추가되길 원하는 로직을 HOC에서 가지고 있다가 로직이 적용된 엘리멘트를 반환하게 된어 횡단 관심사 문제를 해결하는 역할을 한다. 횡단 관심사란? 대표적인 예시로 인증 & 인가 서비스, 로깅, 트랙젝션 처리, 에러처리 등등이 있으며 계층 분리를 통해서 기능을 분리한다고 하여도 중복된 코드가 생길 수 밖에 없는 경우가 있다 이러한 계층에 상관없이 공통적으로 필요한 관심사가 있는데 이것이 횡단 관심사이다. 즉 어플리케이션 전반에 공통적으로 필요한 문제를 횐단 관심사라고 부를 수 있다. // 이렇게 관심사 분리를 통해서 분리를 해도 공통적으로 필요한 로직이 있는 경우가 있다 언제 사..