Zero to Hero
article thumbnail
861. Score After Flipping Matrix
Algorithm 2021. 9. 6. 12:20

Score After Flipping Matrix - 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 0과 1로 이루어진 2차원 배열이 주어진다. 2차원 배열에 대한 한 가지 조작이 가능한데, 그 조작은 행 또는 열을 고르고 그 안의 모든 0은 1로, 1은 0으로 스위칭하는 것이다. 조작을 수행하는 횟수는 제한이 없다. 해당 조작을 통해 2차원 배열을 조작하고, 행을 구성하는 1과 0을 2진수 취급한 뒤 모든 행의 합이 가장 크게 되는 경우 그 합을 반환하는 문제..

article thumbnail
1829. Maximum XOR for Each Query
Algorithm 2021. 9. 4. 11:04

Maximum XOR for Each Query - 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 조건에 대한 범위의 모든 음이 아닌 정수들을 XOR 연산한 후의 값을 A라고 한다면, A XOR B = 2진수 maximumBit 길이의 가장 큰 값을 만족하는 B를 구해 반환하는 문제다. 예시 maximumBit = 2 인 경우, 조건에 맞는 범위의 모든 정수 값을 XOR 연산한 값이 1 이라고 한다면 1 ^ B = 길이 2의 가장 큰 이진수 = 11(2) = 3..

article thumbnail
1641. Count Sorted Vowel Strings
Algorithm 2021. 9. 2. 15:59

Count Sorted Vowel Strings - 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 양의 정수 N이 주어질 때, 알파벳 소문자 모음 5개로 길이 N의 문자열을 만들고 그 가짓수를 반환한다. 이때 문자열을 구성하는 문자들은 사전 순으로 오름차순 정렬돼있는 문자열만 인정한다. 예시 Input: n = 1 Output: 5 Explanation: The 5 sorted strings that consist of vowels only are ["a","e..

article thumbnail
1657. Determine if Two Strings Are Close
Algorithm 2021. 9. 1. 13:58

Determine if Two Strings Are Close - 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 문자열 2개가 주어지고, 문자열을 조작할 수 있는 방법 2가지가 주어진다. 해당 방법을 이용해 두 문자열의 관계를 애너그램(anagram)으로 만들 수 있는지 유무를 반환하는 문제다. 조작법 2가지 Operation 1: Swap any two existing characters. For example, abcde -> aecdb Operation 2..

article thumbnail
1261. Find Elements in a Contaminated Binary Tree
Algorithm 2021. 8. 31. 19:26

Find Elements in a Contaminated Binary Tree - 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 -1로 값이 채워진 이진 탐색 트리가 주어진다. 주어진 조건에 맞게 이진 탐색 트리의 값을 복원한 뒤 반환하려 할 때, 아래 코드를 완성시키는 것이 요구사항이다. 조건 1. root.val == 0 2. If treeNode.val == x and treeNode.left != null, then treeNode.left.val == ..

article thumbnail
890. Find and Replace Pattern
Algorithm 2021. 8. 30. 12:00

Input: words = ["abc","deq","mee","aqq","dkd","ccc"], pattern = "abb" Output: ["mee","aqq"] Explanation: "mee" matches the pattern because there is a permutation {a -> m, b -> e, ...}. "ccc" does not match the pattern because {a -> c, b -> c, ...} is not a permutation, since a and b map to the same letter.​ Find and Replace Pattern - LeetCode Level up your coding skills and quickly land a job. T..