From 1e94042b120b3a2e5cd10292896ee6a3b82367aa Mon Sep 17 00:00:00 2001 From: 724thomas <724thomas@gmail.com> Date: Tue, 3 Jun 2025 10:26:28 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=B5=9C=EC=9B=90=EC=A4=80]Day07?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Q2748.java" | 47 ++++++++++++++++ .../Q1297.java" | 54 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 "leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q2748.java" create mode 100644 "leetcode2/2medium/\354\265\234\354\233\220\354\244\200/Q1297.java" diff --git "a/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q2748.java" "b/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q2748.java" new file mode 100644 index 00000000..66b4d65f --- /dev/null +++ "b/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q2748.java" @@ -0,0 +1,47 @@ +package Leetcode.최원준; + +/* +1. 아이디어 : + + +2. 시간복잡도 : +O( ) + +3. 자료구조/알고리즘 : + + */ + +public class Q2748 { + class Solution { + public int gcd(int a, int b) { + if (b!=0) return gcd(b, a%b); + return a; + } + + public int getFirstDigit(int num) { + while (num >= 10) num /= 10; + return num; + } + + public int getLastDigit(int num) { + return num % 10; + } + + public int countBeautifulPairs(int[] nums) { + int ans = 0; + int n = nums.length; + int[][] digits = new int[n][n]; + for (int i=0; i distincts = new HashSet<>(); + for (char c : key.toCharArray()) { + distincts.add(c); + if (distincts.size() > maxLetters) return false; + } + return true; + } + public int maxFreq(String s, int maxLetters, int minSize, int maxSize) { + int n = s.length(); + Map counter = new HashMap<>(); + + StringBuilder sb = new StringBuilder(); + for (int i=0; i