분류 전체보기
-
[프로그래머스 1단계] 크레인 인형뽑기 게임알고리즘 2024. 3. 6. 08:56
❓문제 설명 2중배열 형태의 배열 하나를 제공하는데 이걸 결국 n x n 형태로 만드는 것임 주어진 moves라는 배열의 순서대로 2중 배열에서 특정 수를 찾는 것임 그래서 찾은 값을 스택에 저장함 스택에 이전값과 추가되는 값이 같은 시 2개를 없애고 count를 올려서 최종적으로 count를 return하는 것임 ✅ 문제 해결 2중 반복문에 대해 사용을 최대한 지양하고 싶어서 고민을 하다가 도저히 풀리지 않아서 풀이를 보고 해석하였음 기본적으로 배열 탐색이라는 키워드를 풀면서 공부를 하게 되면 자연스럽게 알고리즘을 이해할 수 있는 구조라고 한다. 배열에서 찾은 특정 수를 변수에 저장하고 그 수를 0으로 만드는 작업 이부분이 좀 막혔었는데 이런식으로 간단히 구현할 수 있다. function solutio..
-
[프로그래머스 1단계] 문자열 나누기카테고리 없음 2024. 3. 4. 08:16
❓문제 설명 문자열 s가 주어진다. 첫 글자를 읽고 이 첫 글자와 다른 글자가 나온 횟수를 셉니다.(첫 글자와 같은 문자라면 첫 글자 횟수 up) 두 횟수가 같아지는 순간 문자열을 자릅니다. 최종적으로 문자열의 개수를 return하면 됩니다. ✅ 문제 해결 문자열을 자르기 위해서는 글자의 수를 세야하므로 count가 필요하고 그 count와 비교할 또 다른 count가 있어야하고 문자열 비교하기 위해서 객체를 사용하면 어떨까 싶음 객체를 사용해서 문자열: 횟수 형태로 저장한 후 문자열이 잘리면 객체를 초기화하는 것임! 객체를 만들어서 객체가 가진 values 배열을 출력하는 것까지는 문제가 없었으나 마지막으로 values를 비교해서 같은 값이 있을 때 초기화 하는 방법이 구현이 잘 안됬음. functio..
-
[2차 스터디] 2주차 회고록 - Infinite scroll개발일지/구름톤 2024. 3. 4. 05:42
[결과물 이미지] 더보기 [새롭게 알게 된 내용] Masonry - React useSuspenseInfiniteQuery - React-query OpenAPI 활용 방법 [느낀 점] useInfiniteQuery에 대한 이해도가 좀 부족하고 docs를 통해서 이해한 내용이 조금 잘못되어서 개념과 구현을 하면서 어려움이 많았다. 구상한대로 구현이 가능하다고 생각을 했는데 최종 발표에서 다른 조원들과 얘기를 하면서 조금 잘못된 부분이 있다는 것을 느꼈다. 실제 infiniteQuery에서 prefetch를 구현할 수 있는 예제가 있었는데(queryClient.prefetchInfiniteQuery) 이 부분에서 나는 trigger로 인해 데이터를 불러올 때 미리 백그라운드에서 다음 데이터를 불러오는 것이..
-
[혼공컴운] CPU의 작동 원리네트워크/CS Study 2024. 3. 2. 13:49
✅ ALU와 제어장치 📦 ALU 1+2라는 연산을 수행하기 위해서는 피연산자(1, 2)와 수행할 연산(+)이 필요하기에 ALU는 레지스터를 통해 피연산자를 받고 제어장치로부터 제어 신호를 받아 산술, 연산, 논리 연산 등을 수행하는 장치이다. 결과값은 특정 숫자, 문자, 메모리 주소가 될 수 있다. 이 결과값은 메모리에 저장되지 않고 레지스터에 저장된다.(CPU는 메모리에 접근하는 시간이 레지스터보다 느리기에 추가적으로 다른 레지스터에 사용하거나 메모리에 담는 것인 이후에 실행) 부가적인 정보인 플래그를 추가적으로 내보낸다. 다양한 계산을 위한 회로를 가지고 있다.(덧셈: 가산기, 뺄셈: 보수기, 비트의 이동: 시프터, 오버플로우 검출기) 📌 플래그 더보기 위 보기와 같이 CPU에 숫자가 이진법으로 저장..