전체 글 70

분야별 참고 자료 및 학습 계획

C++ / STL '씹어먹는 C++' | 모두의 코드 : C++에 대한 양질의 강의 제공 'C++ 기초 플러스[6판]', Stephen Prata 지음, 성안당, 2020. 03. : 과거 도서관에서 대출해서 참고서로 읽어본 적이 있는데 내용이 방대하고 자세했지만, 번역 상태가 매우 아쉬웠음, 본다면 원서로 볼 것 '윤성우의 열혈 C++ 프로그래밍', 윤성우 지음, 오렌지미디어, 2010. 05. : 필요성이 느껴지면 구매할 예정, 유명한 책이지만, 출판일이 오래 돼서 고민 C++ | 코딩의 시작, TCP School : 전체적인 개념을 리마인드 하기 좋은 사이트 C++ | HackerRank : C++을 주제로 문제 풀이 제공 자료구조 / 알고리즘 Proble..

IT Information 2022.02.11

[C++/Inheritance] Accessing Inherited Functions

문제 Accssing Inherited Functions | HackerRank Accessing Inherited Functions | HackerRank Access inherited functions with the same name. www.hackerrank.com A, B, C 클래스의 함수들을 이용하여 입력된 값을 만들 때, 클래스들이 각각 몇 번 호출되었는지 출력하는 문제입니다. 단, 입력된 값은 오직 2, 3, 5를 소인수로 갖습니다. 풀이 A, B, C 클래스는 각각 전달받은 인수에 2, 3, 5 를 곱하고, 클래스가 호출된 횟수의 값을 저장하고 반환하는 동작을 합니다. void D::check(int new_val) { update_val(new_val); cout

[C++/Debugging] Messages Order

문제 Messages Order | HackerRank Messages Order | HackerRank Implement a software layer over the top of a network, such that sent messages are printed by the recipient in the order they were sent. www.hackerrank.com 메세지를 생성하고, 순서가 보존되지 않는 네트워크에서 송신자가 메세지를 보낸 순서대로 수신자에게 출력하도록 Message 클래스와 MessageFactory 클래스의 구현을 마무리하는 문제입니다. 풀이 class Network { public: static void send_messages(vector messages, Reci..

[C++/STL] Deque-STL

문제 Deque-STL | HackerRank Deque-STL | HackerRank Learn to use deque container. Find the maximum number in each and every contiguous sub array of size K in the given array. www.hackerrank.com 배열을 보다 작은 크기의 부분 배열로 나누고, 각 부분 배열에서의 최댓값을 찾아 출력하는 문제입니다. 코드 설명 모든 부분 배열마다 방문하여 최댓값을 찾는 것은 비효율적이기 때문에 방문을 최소화해야 합니다. 핵심은 부분 배열의 원소들이 어떻게 바뀌는지 파악해야 합니다. 그림을 통해 쉽게 이해해보도록 하겠습니다. 위 그림과 같이 배열이 주어졌고, 부분 배열의 크기는 4 ..

[C++/Class] Abstract Classes - Polymorphism

문제 Abstract Classes - Polymorphism | HackerRank Abstract Classes - Polymorphism | HackerRank Given an abstract class Cache, write a class LRUCache which extends the class Cache and implement an LRU cache. www.hackerrank.com 페이지 교체 알고리즘 (Least Recently Used Algorithm, LRU)을 구현하는 문제입니다. 풀이 처음에 연결 리스트(Linked List)를 사용하여 캐시 저장소를 관리하려고 해서 코드가 복잡해지고, 구현도 힘들었습니다. 문제를 다시 읽고 주어진 코드를 살펴보다가 Cache 클래스의 Map ..

[C++/Classes] Virtual Functions

문제 Virtual Functions | HackerRank Virtual Functions | HackerRank Learn how to use virtual functions and solve the given problem. www.hackerrank.com 기초 클래스인 Person 클래스와 파생 클래스인 Professor 클래스와 Student 클래스를 조건에 맞게 구현하는 문제입니다. 또한, 기초 클래스의 멤버 함수를 가상 함수로 구현하고, 파생 클래스에서 오버로드(Overload)를 거쳐 객체의 타입에 따라 다르게 동작하도록 구현하는 문제입니다. 풀이 int main(){ int n, val; cin>>n; //The number of objects that is going to be cre..

[C++/Classes] Exceptional Server

문제 Link: Exeptional Server | HackerRank Exceptional Server | HackerRank Handle server errors. www.hackerrank.com 주어진 Server 클래스의 멤버 함수인 compute 의 동작에서 발생하는 예외를 처리하는 문제입니다. 풀이 ... // When you use multiple catch blocks, have to consider order. // In this problem, 'exception' is parent exception object of 'bad_alloc'. // If exception be first, catch block for bac_alloc do not run. try { cout

[C++/Classes] Inherited Code

문제 Inherited Code | HackerRank Inherited Code | HackerRank Inherited Code | HackerRank We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies. www.hackerrank.com exception 클래스를 상속받는 BadLengthException 클래스를 구현하여 사용자명을 입력받고 조건에 부합할 때 발생하는 예외를 처리하는 문제입니다. 풀이 class BadLengthException : public exceptio..

[C++/Classes] Box it!

문제 Box It! | HackerRank Box It! | HackerRank Design a class named Box with overloaded operators. www.hackerrank.com 육면체의 길이, 너비, 높이 값을 관리하고, 부피를 구하는 Box 클래스를 구현하는 문제입니다. 또한, 연산자 오버로드를 통해 클래스에 맞는 연산 결과를 출력하는 문제입니다. 풀이 조건에 맞는 클래스(Class)를 구현하고, 오버로드(Overloading)를 활용할 수 있는지에 관해 물어보는 문제입니다. Box() { l = 0; b = 0; h = 0; } Box(int length, int breadth, int height) { l = length; b = breadth; h = height; ..

Git을 이용하여 버전 관리하기 - 기초 명령어

필요한 프로그램 Git (git-scm.com) Git을 사용하므로 당연히 Git 설치는 필요합니다. Git git-scm.com Sourcetree | Free Git GUI for Mac and Windows (sourcetreeapp.com) Git은 Terminal 명령어를 기반으로 사용하지만 GUI를 제공하여 보다 편리하게 사용하게 해주는 프로그램이다. Sourcetree | Free Git GUI for Mac and Windows A Git GUI that offers a visual representation of your repositories. Sourcetree is a free Git client for Windows and Mac. www.sourcetreeapp.com VSCod..

SCM & VCM 2021.03.08
728x90