From 8927baf09224ccbbf3cc572b84303e24dd237911 Mon Sep 17 00:00:00 2001 From: SinnoLn Date: Thu, 29 Oct 2026 22:40:15 +0900 Subject: [PATCH 1/2] 4092. Binary Digit Score --- .../4092. Binary Digit Score.java" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/4092. Binary Digit Score.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/4092. Binary Digit Score.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/4092. Binary Digit Score.java" new file mode 100644 index 000000000..e69de29bb From 89eb7adeb5e3704540fa37d1f7d65a33a0f4ce46 Mon Sep 17 00:00:00 2001 From: SinnoLn Date: Thu, 29 Oct 2026 22:40:30 +0900 Subject: [PATCH 2/2] 11 --- .../4092. Binary Digit Score.java" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/4092. Binary Digit Score.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/4092. Binary Digit Score.java" index e69de29bb..152fe5229 100644 --- "a/leetcode3/\354\235\264\354\247\204\355\235\254/4092. Binary Digit Score.java" +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/4092. Binary Digit Score.java" @@ -0,0 +1,29 @@ +/* + +1. 아이디어 : 2진법으로 변환 후 1의 개수 세기 + +2. 시간복잡도 : O(logN) + +3. 자료구조/알고리즘 : 진법변환 + + */ + +class Solution { + public int calculateScore(int a, int b) { + int s1 = countBit(a); + int s2 = countBit(b); + + if(s1>=s2) return s1*s2; + return s2/s1; + } + + private int countBit(int num) { + int cnt = 0; + while(num>0) { + if(num%2==1) cnt++; + num/=2; + } + + return cnt; + } +} \ No newline at end of file