전체 글
-
둘 만의 암호Programmers 2023. 4. 16. 01:34
두 문자열 s와 skip, 그리고 자연수 index가 주어질 때, 다음 규칙에 따라 문자열을 만들려 합니다. 암호의 규칙은 다음과 같습니다. 문자열 s의 각 알파벳을 index만큼 뒤의 알파벳으로 바꿔줍니다. index만큼의 뒤의 알파벳이 z를 넘어갈 경우 다시 a로 돌아갑니다. skip에 있는 알파벳은 제외하고 건너뜁니다. 예를 들어 s = "aukks", skip = "wbqd", index = 5일 때, a에서 5만큼 뒤에 있는 알파벳은 f지만 [b, c, d, e, f]에서 'b'와 'd'는 skip에 포함되므로 세지 않습니다. 따라서 'b', 'd'를 제외하고 'a'에서 5만큼 뒤에 있는 알파벳은 [c, e, f, g, h] 순서에 의해 'h'가 됩니다. 나머지 "ukks" 또한 위 규칙대로 바..
-
[OS] Synchronous I/O와 Asynchronous I/OComputer Science 2023. 4. 12. 08:35
- I/O, 입출력 컴퓨터 시스템이 컴퓨터 외부의 입출력 장치들과 데이터를 주고받는 것 동기식 입출력, Synchronous I/O 어떤 프로그램이 입출력 요청을 했을 때 디스크 입출력이 완료된 후에야 그 프로그램이 후속 작업을 수행할 수 있는 방식 프로그램이 디스크에서 어떤 정보를 읽어오라는 요청을 했을 때 디스크 입출력이 완료되기까지는 어느 정도의 시간이 소요된다. 이때 동기식 입출력은 입출력이 진행되는 동안 그 프로그램의 다음 명령을 수행하지 않고 기다린다. 이후 입출력이 완료되어 인터럽트를 통해 그 사실을 전달된 후에야 CPU의 제어권이 프로그램에게 넘어가서 다음 명령을 수행할 수 있게 된다. 동기식 입출력은 CPU는 입출력 연산이 끝날 때까지 인터럽트를 기다리며 자원을 낭비하게 되는 것이다. 이..
-
[재귀 함수] 신나는 함수 실행Programmers 2023. 4. 7. 14:35
문제 재귀 호출만 생각하면 신이 난다! 아닌가요? 다음과 같은 재귀함수 w(a, b, c)가 있다. if a 20, then w(a, b, c) returns: w(20, 20, 20) if a < b and b < c, then w(a, b, c) returns: w(a, b, c-1) + w(a, b-1, c-1) - w(a, b-1, c) otherwise it returns: w(a-1, b, c) + w(a-1, b-1, c) + w(a-1, b, c-1) - w(a-1, b-1, c-1) 위의 함수를 구현하는 것은 매우 쉽다. 하지만, 그대로 구현하면 값을 구하는데 매우 오랜 시간이 걸린다. (예를 들면, a=15, b=15, c=15) a, b, c가 주어졌을 때, w(a, b, c)를 출력..
-
[재귀 함수] 재귀 함수란 무엇인가요?Programmers 2023. 4. 7. 13:38
문제 평소에 질문을 잘 받아주기로 유명한 중앙대학교의 JH 교수님은 학생들로부터 재귀함수가 무엇인지에 대하여 많은 질문을 받아왔다. 매번 질문을 잘 받아주셨던 JH 교수님이지만 그는 중앙대학교가 자신과 맞는가에 대한 고민을 항상 해왔다. 중앙대학교와 자신의 길이 맞지 않다고 생각한 JH 교수님은 결국 중앙대학교를 떠나기로 결정하였다. 떠나기 전까지도 제자들을 생각하셨던 JH 교수님은 재귀함수가 무엇인지 물어보는 학생들을 위한 작은 선물로 자동 응답 챗봇을 준비하기로 했다. JH 교수님이 만들 챗봇의 응답을 출력하는 프로그램을 만들어보자. 입력 교수님이 출력을 원하는 재귀 횟수 N(1 ≤ N ≤ 50)이 주어진다. 출력 출력 예시를 보고 재귀 횟수에 따른 챗봇의 응답을 출력한다. 예제 입력 1 복사 2 예..
-
SaaS, Software as a ServiceData Engineer 2023. 4. 2. 23:48
SaaS는 클라우드 기반의 소프트웨어 제공 모델로, 클라우드 제공업체가 클라우드 애플리케이션 소프트웨어를 개발 및 유지/관리하고, 자동 소프트웨어 업데이트를 제공하고, 인터넷을 통해 Pay-as-you-Go 방식으로 고객에게 소프트웨어를 제공한다. 퍼블릭 클라우드 제공업체는 미들웨어, 애플리케이션 소프트웨어, 보안을 포함한 모든 하드웨어 및 전통적인 소프트웨어를 관리한다. 따라서 SaaS 고객은 비용을 크게 줄일 수 있으며, On-Premise 시스템 및 소프트웨어를 유지/관리할 때보다 더 빠르게 솔루션을 배포, 확장 및 업그레이드가 가능하며 총 소유 비용을 훨씬 더 정확하게 예측할 수 있는 장점이 있다. SaaS의 역사 2000년대 초 개발된 1세대 SaaS 솔루션은 단절, 경직된 형태였으며, 한 가지..
-
[검색 엔진] Python + Django + ElasticSearch 활용 검색 엔진 만들기Search Engine 2023. 4. 1. 01:11
데이터 파이프라인 실습을 하려고 했지만 문제가 발생(..)해 우선 실습 완성 경험을 만들어보고자 검색엔진을 만들어보려고 한다. ※ 너드팩토리 님의 블로그(https://blog.nerdfactory.ai/2019/04/29/django-elasticsearch-restframework.html)를 참고해 실습을 진행하였다. Django Django는 Python 기반의 웹 프레임워크로, 미리 만들어진 강력한 라이브러리들을 보유하고 있어 좀 더 쉽고 빠른 백엔드 서버 구축이 가능해진다. ElasticSearch Apache Lucene 기반으로 개발된 오픈소스 분산 검색엔진으로, 자동완성, 다국어 검색, 철자 수정, 미리 보기 등 Lucene의 강력하고 풍부한 기능을 대부분 지원한다. 특히 기존 DBMS에..
-
[Data Pipeline 실습] 1. 데이터 생성Data Engineer 2023. 3. 30. 17:52
원래 계획대로라면 운영체제를 들어야하는 게 맞으나, 지난 2주간 네트워크 수업을 듣다보니 일방적인 이론 수업에 흥미를 잃었다. 그래서 이번주는 T아카데미에서 했었던 데이터 파이프라인 이론과 실습을 곁들여 공부하기로 했다. 실습 과정 Twitter API로 JSON log 데이터를 받아와서 Kafka에 전송하고, Consumer를 Logstash로 지정해 하나는 ElasticSearch로, 다른 하나는 Google Cloud Service로 보내 각각 Kibana와 Zeppelin으로 분석을 할 예정이다. 실습 환경 설정 - Window 7 이상 - VirtualBox 다운로드(5.1.22 ver) - Ubuntu 설치(16.04 LTS ver) 2017년도 자료라서 그런지 현재 버전과 조금 맞지 않다....
-
같은 숫자는 싫어Programmers 2023. 3. 26. 01:20
문제 설명 배열 arr가 주어집니다. 배열 arr의 각 원소는 숫자 0부터 9까지로 이루어져 있습니다. 이때, 배열 arr에서 연속적으로 나타나는 숫자는 하나만 남기고 전부 제거하려고 합니다. 단, 제거된 후 남은 수들을 반환할 때는 배열 arr의 원소들의 순서를 유지해야 합니다. 예를 들면, arr = [1, 1, 3, 3, 0, 1, 1] 이면 [1, 3, 0, 1] 을 return 합니다. arr = [4, 4, 4, 3, 3] 이면 [4, 3] 을 return 합니다. 배열 arr에서 연속적으로 나타나는 숫자는 제거하고 남은 수들을 return 하는 solution 함수를 완성해 주세요. 제한사항 배열 arr의 크기 : 1,000,000 이하의 자연수 배열 arr의 원소의 크기 : 0보다 크거나 ..