본문 바로가기

Algorithm/Implementation

(750)
(C++) - LeetCode (easy) 1046. Last Stone Weight https://leetcode.com/problems/last-stone-weight/description/ Last Stone Weight - LeetCode Can you solve this real interview question? Last Stone Weight - You are given an array of integers stones where stones[i] is the weight of the ith stone. We are playing a game with the stones. On each turn, we choose the heaviest two stones and smash them leetcode.com simulation 문제였습니다. 📕 풀이방법 📔 풀이과정 stones..
(C++) - LeetCode (easy) 1021. Remove Outermost Parentheses https://leetcode.com/problems/remove-outermost-parentheses/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 간단 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 정답 변수 ans, 깊이 depth를 선언해줍니다. 📔 풀이과정 valid한 형태의 문자열이 들어오므로 s의 원소를 순회하며 바..
(C++) - LeetCode (easy) 1018. Binary Prefix Divisible By 5 https://leetcode.com/problems/binary-prefix-divisible-by-5/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 정답 ans와 현황 cur를 선언해준 후 적절히 초기화해줍니다. 📔 풀이과정 nums의 길이가 10^5(10만)이므로 매번 전체 십진..
(C++, Rust) - LeetCode (easy) 1013. Partition Array Into Three Parts With Equal Sum https://leetcode.com/problems/partition-array-into-three-parts-with-equal-sum/ LeetCode - The World's Leading Online Programming Learning Platform 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. 3등분으로 나눠지며 각 부분들은 전체 원소 합 / 3이 되어야 함을 생각하면 편합니다. 또한 부분들이 3등분을 초과하..
(C++, Rust) - LeetCode (easy) 1009. Complement of Base 10 Integer https://leetcode.com/problems/complement-of-base-10-integer/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 bit masking으로 해결한 문제였습니다. 📕 풀이방법 📔 풀이과정 n을 인자로 n의 bit를 반전하는 함수 get bit mask를 수행합니다. 이 함수는 n보다 크거나 작으며 ..
(C++) - LeetCode (easy) 999. Available Captures for Rook https://leetcode.com/problems/available-captures-for-rook/description/ LeetCode - The World's Leading Online Programming Learning Platform 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. {행, 열}을 저장할 struct Coord를 선언합니다. 2. 정답변수 ans를 선언해줍니다. 📔 풀이과정 1. rook의 행,..
(Python3) - LeetCode (easy) 989. Add to Array-Form of Integer https://leetcode.com/problems/add-to-array-form-of-integer/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 큰 수 다루는 문제였습니다. 📕 풀이방법 📔 풀이과정 큰 수 사칙연산을 지원하는 python3을 사용해 풀었습니다.1. int로의 문자열 변환에 사용할 수 있는 문자열의 최대 길이가 1..
(C++, Rust) - LeetCode (easy) 941. Valid Mountain Array https://leetcode.com/problems/di-string-match/description/ DI String Match - LeetCode Can you solve this real interview question? DI String Match - A permutation perm of n + 1 integers of all the integers in the range [0, n] can be represented as a string s of length n where: * s[i] == 'I' if perm[i] < perm[i + 1], and * s[i] == 'D' if perm leetcode.com 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 s의 길이 sz, 숫자 ..