목록전체 글 (956)
넘치게 채우기
https://school.programmers.co.kr/learn/courses/30/lessons/86971 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 유형 : 완전 탐색 문제 난이도 : Level 2 문제 문제 설명 n개의 송전탑이 전선을 통해 하나의 트리 형태로 연결되어 있습니다. 당신은 이 전선들 중 하나를 끊어서 현재의 전력망 네트워크를 2개로 분할하려고 합니다. 이때, 두 전력망이 갖게 되는 송전탑의 개수를 최대한 비슷하게 맞추고자 합니다. 송전탑의 개수 n, 그리고 전선 정보 wires가 매개변수로 주어집니다. 전선들 중 하나를 ..
십진수를 이진수로 표기하고, 이진수 표기에서 1을 구하고 싶다면, 십진수 i를 2로 나눈 값 i/2의 1의 개수에, i가 홀수면 1을 더하고, 짝수인 경우 더하지 않으면 된다. #include // 십진수를 이진수로 변환하고 1의 개수를 구하는 함수 int countOnesInBinary(int n) { int count = 0; while (n > 0) { count += n % 2; // 현재 비트가 1이면 count에 1을 더함 n /= 2; // 십진수를 2로 나눔 } return count; } int main() { int i = 25; // 예시로 25를 사용 int binaryCount = countOnesInBinary(i); std::cout
https://leetcode.com/problems/counting-bits/description/ Counting Bits - LeetCode Can you solve this real interview question? Counting Bits - Given an integer n, return an array ans of length n + 1 such that for each i (0 1] + (i & 1); } return table; } };
https://leetcode.com/problems/minimum-number-of-taps-to-open-to-water-a-garden/description/ Minimum Number of Taps to Open to Water a Garden - LeetCode Can you solve this real interview question? Minimum Number of Taps to Open to Water a Garden - There is a one-dimensional garden on the x-axis. The garden starts at the point 0 and ends at the point n. (i.e The length of the garden is n). There a..
https://leetcode.com/problems/summary-ranges/description/?envType=study-plan-v2&envId=top-interview-150 Summary Ranges - LeetCode Can you solve this real interview question? Summary Ranges - You are given a sorted unique integer array nums. A range [a,b] is the set of all integers from a to b (inclusive). Return the smallest sorted list of ranges that cover all the numbers in the arr leetcode.co..
https://leetcode.com/problems/minimum-penalty-for-a-shop/description/ Minimum Penalty for a Shop - LeetCode Can you solve this real interview question? Minimum Penalty for a Shop - You are given the customer visit log of a shop represented by a 0-indexed string customers consisting only of characters 'N' and 'Y': * if the ith character is 'Y', it means that cust leetcode.com 문제 유형 : 구간 합(Prefix ..
https://leetcode.com/problems/valid-sudoku/description/?envType=study-plan-v2&envId=top-interview-150 Valid Sudoku - LeetCode Can you solve this real interview question? Valid Sudoku - Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: 1. Each row must contain the digits 1-9 without repetition. 2. Each c leetcode.com 문제 유형 : 2..
https://leetcode.com/problems/valid-anagram/description/?envType=study-plan-v2&envId=top-interview-150 Valid Anagram - LeetCode Can you solve this real interview question? Valid Anagram - Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using leetcode.com ..
입출력 팁 import java.io.*; public class FastIOExample { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out)); // 문자열로 읽고 출력하기 String inputLine = reader.readLine(); writer.write("입력 받은 문자열: " + inputLine); // 숫자로 읽고 출력하기 int num = Integer..
https://leetcode.com/problems/interleaving-string/description/ Interleaving String - LeetCode Can you solve this real interview question? Interleaving String - Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2. An interleaving of two strings s and t is a configuration where s and t are divided into n and m subs leetcode.com 문제 유형 : 문자열 처리 / 동적 계획법 문제 난이도 : M..