목록분류 전체보기 (591)
어흥
문제 링크: www.acmicpc.net/problem/2812 2812번: 크게 만들기 N자리 숫자가 주어졌을 때, 여기서 숫자 K개를 지워서 얻을 수 있는 가장 큰 수를 구하는 프로그램을 작성하시오. www.acmicpc.net 1. 주의할 점 - 스택 or 그리디를 이용하여 해결한다 - 본인이 생각한 특수 TC 이외에도 많은 특수 TC가 존재한다 ##일부 TC #1 6 2 391123 //output : 9123 #2 6 2 436436 //output : 6436 #3 7 3 7654321 //output : 7654 #4 6 2 362514 //output : 6514 #5 2 1 19 //output: 9 #6 7 2 9543543 //output: 9554 2. 구현 - String형태가 아..
문제 링크: www.acmicpc.net/problem/14267 14267번: 회사 문화 1 영선회사에는 매우 좋은 문화가 있는데, 바로 상사가 직속 부하를 칭찬하면 그 부하가 부하의 직속 부하를 연쇄적으로 칭찬하는 내리 칭찬이 있다. 즉, 상사가 한 직속 부하를 칭찬하면 그 부하 www.acmicpc.net 1. 주의할 점 - 한명의 상사에겐 여러명의 직속부하가 있을 수 있다 - 칭찬을 모두 저장했다가 트리의 순서에 따라 부여한다 2. 구현 - 모든 직원들에 대해 상사->직속 부하에 대한 정보를 V[]벡터에 저장한다 - 입력받은 모든 칭찬에 대해 해당 직원의 index번호에 해당하는 Compliment[]에 더한다(한 직원이 여러번 받았을 수도 있으므로 할당이 아닌 더하기) - 사장인 1번부터 시작하..
문제 링크: www.hackerrank.com/challenges/ctci-making-anagrams/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=strings Strings: Making Anagrams | HackerRank How many characters should one delete to make two given strings anagrams of each other? www.hackerrank.com 1. 주의할 점 - 26*2 크기의 배열을 이용하여 비교한다 2. 구현 - A 문자열에 속하는 모든 알파벳들의 개수 alpha[0][]에 기록한다 - B 문자열에 속하는 모든..
문제 링크: www.hackerrank.com/challenges/frequency-queries/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=dictionaries-hashmaps Frequency Queries | HackerRank Process the insert/delete queries and report if any integer is there with a particular frequency. www.hackerrank.com 1. 주의할 점 - X,Y,Z의 범위가 1~10^9사이다 - Map + 배열을 이용하여 해결한다 - 배열의 범위가 크지 않으므로, indexOutOf..
문제 링크: www.hackerrank.com/challenges/count-triplets-1/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=dictionaries-hashmaps Count Triplets | HackerRank Return the count of triplets that form a geometric progression. www.hackerrank.com 1. 주의할 점 - R이 1이라면? - 범위는 Long이다. 개수 또한 Long이 될 수 있다 - 배열의 값이 내림차순으로 정리되는 경우, 답은 0이다 [생각한 TC] #1 5 2 1 2 4 2 4 #2 4 3 16 ..
문제 링크: www.hackerrank.com/challenges/sherlock-and-anagrams/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=dictionaries-hashmaps Sherlock and Anagrams | HackerRank Find the number of unordered anagramic pairs of substrings of a string. www.hackerrank.com 1. 주의할 점 - substring 길이에 따라 다른 Map에 저장한다 - 정렬을 이용한다 2. 구현 - 최대 길이 100까지 담을 수 있는 Map[]을 생성한다. Map은 형태로..
문제 링크: www.hackerrank.com/challenges/two-strings/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=dictionaries-hashmaps Two Strings | HackerRank Given two strings, you find a common substring of non-zero length. www.hackerrank.com 1. 주의할 점 - 문제를 잘 읽자 - KMP 알고리즘을 사용하지 않아도 된다 2. 구현 - 3가지 방법으로 접근했지만 성공한것은 1개 뿐 (1) Set, 시간복잡도: O(N^2*M^2) -> TLE(4/8 성공) - s1의 ..
문제 링크: www.hackerrank.com/challenges/ctci-ransom-note/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=dictionaries-hashmaps Hash Tables: Ransom Note | HackerRank Given two sets of dictionaries, tell if one of them is a subset of the other. www.hackerrank.com 1. 주의할 점 - Map에 대해서 알고있어야 한다 - Magazine에 A 단어가 B개 있을 때, Note에 A 단어가 B개보다 많다면 No 출력 2. 구현 - Magazi..