www.acmicpc.net/problem/7785 7785번: 회사에 있는 사람 첫째 줄에 로그에 기록된 출입 기록의 수 n이 주어진다. (2 ≤ n ≤ 106) 다음 n개의 줄에는 출입 기록이 순서대로 주어지며, 각 사람의 이름이 주어지고 "enter"나 "leave"가 주어진다. "enter"인 경우는 www.acmicpc.net 대기업에서 근무하는 상근이가 사내 근퇴 로그를 가지고 있다. 현재 퇴근하지 않아서 사내에 근무중인 사원의 명단을 사즌의 역순으로 출력하는 문제다. input 출입 로그 숫자 사원명 출근or퇴근 output 근무중 사원의 이름 #include #include using namespace std; int main() { ios_base::sync_with_stdio(false..
www.acmicpc.net/problem/9375 9375번: 패션왕 신해빈 첫 번째 테스트 케이스는 headgear에 해당하는 의상이 hat, turban이며 eyewear에 해당하는 의상이 sunglasses이므로 (hat), (turban), (sunglasses), (hat,sunglasses), (turban,sunglasses)로 총 5가지 이다. www.acmicpc.net 해빈이가 옷을 입을 경우의 수를 계산하는 문제다. 각 의상별로 입거나 안입을 수 있으며 하나도 안입는 경우는 안된다. 의상의 이름은 겹치지 않는다. 의상의 종류는 겹쳐도 된다. 모든 경우의 수를 조합하여 return시킨다. input 테스트케이스 의상수 의상이름 의상종류 output 경우의 수 #include #incl..
www.acmicpc.net/problem/1302 1302번: 베스트셀러 첫째 줄에 오늘 하루 동안 팔린 책의 개수 N이 주어진다. 이 값은 1,000보다 작거나 같은 자연수이다. 둘째부터 N개의 줄에 책의 제목이 입력으로 들어온다. 책의 제목의 길이는 50보다 작거나 같고 www.acmicpc.net 당일 팔린 책 중 가장 많이 팔린 책의 이름을 출력한다.(같은 값이 있을 경우 사전순 가장 앞의 값을 출력) #include #include #include using namespace std; string dicCompare(string first, string second) { if (first > second) return first; else return second; } string soluti..
leetcode.com/problems/design-hashmap/submissions/ Design HashMap - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Hash table관련 라이브러리 없이 작동하는 객체를 만들라고한다. class MyHashMap { private: public: vector map; MyHashMap() {} ~MyHashMap() { map.clear(); } void put(int key, int value) { if (g..
leetcode.com/problems/design-hashset/ Design HashSet - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Hash table관련 라이브러리 사용없이 Hash Set 형태의 클래스를 만들라고 한다. class MyHashSet { public: list set; MyHashSet() {} void add(int key) { set.push_back(key); } void remove(int key) { set.remove(k..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/XOayv/btq10R92zNj/YFdjisShKkWtCtbqmbMAG0/img.png)
leetcode.com/problems/find-common-characters/submissions/ Find Common Characters - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com leetCode 배열 A를 argument로 넘겨준다. parameter A에는 각 원소마다 문자열들이 들어있고, 각 문자열에 모두 포함되어있는 문자(중복 포함)를 배열로 return하라고 한다. 예시 1 input : ["bella","label","roller"] o..
leetcode.com/problems/subdomain-visit-count/submissions/ Subdomain Visit Count - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 웹 사이트 도메인, 서브도메인의 방문횟수 를 구하는 문제이다. Input값으로 문자열 배열이 주어진다. 원소 하나에는 도메인과 도메인의 방문횟수가 띄어쓰기로 구분한 하나의 문자열로 주어진다. 그리고 배열의 각 원소에서 도메인, 서브 도메인에 대한 총 방문횟수를 구해서 배열로..