목록해시 (44)
넘치게 채우기
https://www.acmicpc.net/problem/19832BOJ - 19832 - Configuration file문제 유형: 문자열 처리, 파싱, 스택, 해시문제 난이도: Gold IV시간 제한: 2초메모리 제한: 512MB 문제Vadim develops a parser for configuration files of his project. A configuration file consists of blocks delimited with braces: "{" marks the beginning of the block, and "}" marks the end of the block. Blocks can be nested. One block can contains several other bloc..
https://leetcode.com/problems/find-elements-in-a-contaminated-binary-tree/description/?envType=daily-question&envId=2025-02-21leetcode - Find Elements in a Contaminated Binary Tree문제 유형: 트리, 해시문제 난이도: Medium 문제Given a binary tree with the following rules:root.val == 0For any treeNode:If treeNode.val has a value x and treeNode.left != null, then treeNode.left.val == 2 * x + 1If treeNode.val has a..

https://www.acmicpc.net/problem/25279BOJ - Treehouse문제 유형: 기하학, 수학, 해시문제 난이도: Gold III시간 제한: 3초메모리 제한: 1024MB 문제Pusheen wants to build a treehouse in the Treehouse forest in Brunnshög in the north of Lund. The treehouse should to be built on a square platform in the treetops, with a tree in each of the four corners. When Pusheen has picked a spot to built the treehouse, trees that are located be..
https://leetcode.com/problems/count-number-of-bad-pairs/description/leetcode - Count Number of Bad Pairs문제 유형: 투 포인터, 해시, 정렬, 수학문제 난이도: Medium 문제You are given a 0-indexed integer array nums. A pair of indices (i, j) is a bad pair if i and j - i != nums[j] - nums[i].Return the total number of bad pairs in nums. 0-indexed의 정수 배열 nums가 주어진다.(i, j)페어는 다음 조건을 만족하면 나쁜 페어이다: if i 나쁜 페어의 개수를 구하시오. 풀이전체..
https://leetcode.com/problems/design-a-number-container-system/description/leetcode - Design a Number Container System문제 유형: 우선순위 큐, 힙, 해시문제 난이도: Medium 문제Design a number container system that can do the following:Insert or Replace a number at the given index in the system.Return the smallest index for the given number in the system.Implement the NumberContainers class:NumberContainers() Initial..
https://leetcode.com/problems/find-the-number-of-distinct-colors-among-the-balls/description/leetcode - Find the Number of Distinct Colors Among the Balls문제 유형: 해시문제 난이도: Medium 문제You are given an integer limit and a 2D array queries of size n x 2.There are limit + 1 balls with distinct labels in the range [0, limit]. Initially, all balls are uncolored. For every query in queries that is of the ..
https://leetcode.com/problems/tuple-with-same-product/description/leetcode - Tuple with Same Product문제 유형: 수학, 해시문제 난이도: Medium 문제Given an array nums of distinct positive integers, return the number of tuples (a, b, c, d) such that a * b = c * d where a, b, c, and d are elements of nums, and a != b != c != d. 독립적인 정수 배열 nums가 주어집니다.a*b = c*d인 (a, b, c, d)튜플조합의 개수를 모두 구하시오. 풀이하나의 조합을 구하면, 8개의 튜플을..

https://www.acmicpc.net/problem/28707BOJ - 배열 정렬문제 유형: 문자열 처리, 최단 경로, 다익스트라, 해시문제 난이도: Gold I시간 제한: 1초메모리 제한: 1024MB 문제길이가 N인 양의 정수로 이루어진 배열 A=[A1,A2,⋯,AN]이 주어집니다. 이 배열을 비내림차순, 즉, A1≤A2≤⋯≤AN이 되도록 정렬하기 위해서 다음과 같은 M가지 조작을 순서와 횟수에 상관 없이 원하는 만큼 할 수 있습니다. A의 li번째 수와 ri번째 수를 바꿉니다. 비용은 ci가 듭니다. (1≤i≤M) A를 비내림차순으로 정렬하기 위해 필요한 비용 총합의 최솟값을 출력하세요. 입력첫 줄에 배열 A의 길이 N이 주어집니다. (2≤N≤8)둘째 줄에 A의 각 원소 A1,⋯,AN이 공백으..
https://www.acmicpc.net/problem/7453BOJ - 합이 0인 네 정수문제 유형: 이진탐색, 해시, 투포인터, MITM(Meet-In-The-Middle)문제 난이도: Gold II시간 제한: 12초메모리 제한: 1024MB 문제정수로 이루어진 크기가 같은 배열 A, B, C, D가 있다.A[a], B[b], C[c], D[d]의 합이 0인 (a, b, c, d) 쌍의 개수를 구하는 프로그램을 작성하시오. 입력첫째 줄에 배열의 크기 n (1 ≤ n ≤ 4000)이 주어진다. 다음 n개 줄에는 A, B, C, D에 포함되는 정수가 공백으로 구분되어져서 주어진다. 배열에 들어있는 정수의 절댓값은 최대 2^28이다. 출력합이 0이 되는 쌍의 개수를 출력한다. 풀이브루트 포스는 n^4의 ..
https://leetcode.com/problems/longest-square-streak-in-an-array/description/?envType=daily-question&envId=2024-10-28leetcode - Longest Square Streak in an Array문제 유형: 해시, 집합, 이진 탐색, 다이나믹 프로그래밍문제 난이도: Medium 문제You are given an integer array nums. A subsequence of nums is called a square streak if:The length of the subsequence is at least 2, andafter sorting the subsequence, each element (except t..