Tinkerbell Glitter
[241220] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ฝ”๋”ฉ ๊ธฐ์ดˆ ํŠธ๋ ˆ์ด๋‹ ๋ฌธ์ œ
ยท
[๋‚ด๋ฐฐ์บ ] ๋ณธ ์บ ํ”„ (24.11.25 ~ 25.03.01)๐Ÿƒ๐Ÿป‍โ™€๏ธ‍/๋ฌธ์ œ ํ’€์ด๐Ÿ’ฏ
๊ทธ๋ฆผ ํ™•๋Œ€ ๐Ÿ–ผ๏ธQ. ์ง์‚ฌ๊ฐํ˜• ํ˜•ํƒœ์˜ ๊ทธ๋ฆผ ํŒŒ์ผ์ด ์žˆ๊ณ , ์ด ๊ทธ๋ฆผ ํŒŒ์ผ์€ 1 × 1 ํฌ๊ธฐ์˜ ์ •์‚ฌ๊ฐํ˜• ํฌ๊ธฐ์˜ ํ”ฝ์…€๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ทธ๋ฆผ ํŒŒ์ผ์„ ๋‚˜ํƒ€๋‚ธ ๋ฌธ์ž์—ด ๋ฐฐ์—ด `picture`๊ณผ ์ •์ˆ˜ `k`๊ฐ€ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์งˆ ๋•Œ, ์ด ๊ทธ๋ฆผ ํŒŒ์ผ์„ ๊ฐ€๋กœ ์„ธ๋กœ๋กœ `k`๋ฐฐ ๋Š˜๋ฆฐ ๊ทธ๋ฆผ ํŒŒ์ผ์„ ๋‚˜ํƒ€๋‚ด๋„๋ก ๋ฌธ์ž์—ด ๋ฐฐ์—ด์„ return ํ•˜๋Š” solution ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•ด ์ฃผ์„ธ์š”.์ œํ•œ์‚ฌํ•ญ1 ≤ picture์˜ ๊ธธ์ด ≤ 201 ≤ picture์˜ ์›์†Œ์˜ ๊ธธ์ด ≤ 20๋ชจ๋“  picture์˜ ์›์†Œ์˜ ๊ธธ์ด๋Š” ๊ฐ™์Šต๋‹ˆ๋‹ค.picture์˜ ์›์†Œ๋Š” '.'๊ณผ 'x'๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์Šต๋‹ˆ๋‹ค.1 ≤ k ≤ 10์ž…์ถœ๋ ฅ ์˜ˆ์‹œpicturekresult[".xx...xx.", "x..x.x..x", "x...x...x", ".x.....x.", "..x....
[241217] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ž…๋ฌธ ๋ฌธ์ œ
ยท
[๋‚ด๋ฐฐ์บ ] ๋ณธ ์บ ํ”„ (24.11.25 ~ 25.03.01)๐Ÿƒ๐Ÿป‍โ™€๏ธ‍/๋ฌธ์ œ ํ’€์ด๐Ÿ’ฏ
ํ”ผ์ž ๋‚˜๋ˆ  ๋จน๊ธฐ (2)Q. ๋จธ์“ฑ์ด๋„ค ํ”ผ์ž๊ฐ€๊ฒŒ๋Š” ํ”ผ์ž๋ฅผ ์—ฌ์„ฏ ์กฐ๊ฐ์œผ๋กœ ์ž˜๋ผ ์ค๋‹ˆ๋‹ค. ํ”ผ์ž๋ฅผ ๋‚˜๋ˆ ๋จน์„ ์‚ฌ๋žŒ์˜ ์ˆ˜ `n`์ด ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์งˆ ๋•Œ, `n`๋ช…์ด ์ฃผ๋ฌธํ•œ ํ”ผ์ž๋ฅผ ๋‚จ๊ธฐ์ง€ ์•Š๊ณ  ๋ชจ๋‘ ๊ฐ™์€ ์ˆ˜์˜ ํ”ผ์ž ์กฐ๊ฐ์„ ๋จน์–ด์•ผ ํ•œ๋‹ค๋ฉด ์ตœ์†Œ ๋ช‡ ํŒ์„ ์‹œ์ผœ์•ผ ํ•˜๋Š”์ง€๋ฅผ return ํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด๋ณด์„ธ์š”.A.def gcd(a, b): # ํ•œ ๋ฒˆ ์“ฐ๊ณ  ๋ฒ„๋ ค์งˆ ์ตœ๋Œ€๊ณต์•ฝ์ˆ˜ ํ•จ์ˆ˜ ํ˜ธ์ถœํ•ด์ค๋‹ˆ๋‹ค... while b: a, b= b, a % b return adef lcm(a, b): # ์ตœ์†Œ๊ณต๋ฐฐ์ˆ˜๋ฅผ ์œ„ํ•ด ์ตœ๋Œ€๊ณต์•ฝ์ˆ˜๋ฅผ ์ƒ์„ฑํ•œ ๋‚˜... ์•„์ด๊ณ  ๋น„ํšจ์œจ์ ์ด๋‹ค... return (a * b) // gcd(a, b)def solution(n): nanum = n // 6 namuji ..
[241217] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ž…๋ฌธ ๋ฌธ์ œ
ยท
[๋‚ด๋ฐฐ์บ ] ๋ณธ ์บ ํ”„ (24.11.25 ~ 25.03.01)๐Ÿƒ๐Ÿป‍โ™€๏ธ‍/๋ฌธ์ œ ํ’€์ด๐Ÿ’ฏ
์ตœ๋นˆ๊ฐ’ ๊ตฌํ•˜๊ธฐQ. ์ตœ๋นˆ๊ฐ’์€ ์ฃผ์–ด์ง„ ๊ฐ’ ์ค‘์—์„œ ๊ฐ€์žฅ ์ž์ฃผ ๋‚˜์˜ค๋Š” ๊ฐ’์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์ •์ˆ˜ ๋ฐฐ์—ด `array` ๊ฐ€ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์งˆ ๋•Œ,์ตœ๋นˆ๊ฐ’์„ return ํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด๋ณด์„ธ์š”. ์ตœ๋นˆ๊ฐ’์ด ์—ฌ๋Ÿฌ ๊ฐœ๋ฉด -1์„ return ํ•ฉ๋‹ˆ๋‹ค.A.from collections import Counter # ์ปฌ๋ ‰์…˜ ๋ชจ๋“ˆ์˜ ์นด์šดํ„ฐ ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค.def solution(array): # ์ธ์ž๋ฅผ array๋กœ ๋ฐ›๋Š” solution ํ•จ์ˆ˜ ํ˜ธ์ถœ # Counter ํ•จ์ˆ˜๋Š” ๋ฆฌ์ŠคํŠธ์˜ ์š”์†Œ(key:array)๊ฐ€ ๋ช‡ ๋ฒˆ ๋‚˜์˜ค๋Š”์ง€(value)๋ฅผ dict ํ˜•ํƒœ๋กœ ์ €์žฅ ๋ฐ›์Šต๋‹ˆ๋‹ค. array_count = Counter(array) # array_count ๋ณ€์ˆ˜์— Counter(array)๋ฅผ ํ• ๋‹นํ•ฉ๋‹ˆ๋‹ค. ma..
[241212] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ž…๋ฌธ ๋ฌธ์ œ
ยท
[๋‚ด๋ฐฐ์บ ] ๋ณธ ์บ ํ”„ (24.11.25 ~ 25.03.01)๐Ÿƒ๐Ÿป‍โ™€๏ธ‍/๋ฌธ์ œ ํ’€์ด๐Ÿ’ฏ
์‚ผ๊ฐํ˜•์˜ ์™„์„ฑ์กฐ๊ฑดQ. ์‚ผ๊ฐํ˜•์˜ ์„ธ ๋ณ€์˜ ๊ธธ์ด๊ฐ€ ๋‹ด๊ธด ๋ฐฐ์—ด `sides` ์ด ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์ง‘๋‹ˆ๋‹ค. ์„ธ ๋ณ€์œผ๋กœ ์‚ผ๊ฐํ˜•์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค๋ฉด 1, ๋งŒ๋“ค ์ˆ˜ ์—†๋‹ค๋ฉด 2๋ฅผ return ํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”. # ์ฃผ์„์ฒ˜๋ฆฌ ๋œ ์ฝ”๋“œ๋“ค์€ ์ˆ˜์ • ์ „ ๊ธฐ์กด ์ฝ”๋“œ ์ž…๋‹ˆ๋‹ค.def solution(sides): #answer = sides minusdata: return 2 elif in_max ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์— ์žˆ๋˜ ํƒ€์ธ๋“ค์˜ ๋ฌธ์ œํ’€์ด:1.def solution(sides): # ์ปดํ”„๋ฆฌํ•ธ์…˜ return 1 if max(sides)  2.def solution(sides): sides.sort() return 1 if sides[0]+sides[1]>sides[2] els..
[241211] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ž…๋ฌธ ๋ฌธ์ œ
ยท
[๋‚ด๋ฐฐ์บ ] ๋ณธ ์บ ํ”„ (24.11.25 ~ 25.03.01)๐Ÿƒ๐Ÿป‍โ™€๏ธ‍/๋ฌธ์ œ ํ’€์ด๐Ÿ’ฏ
๋‚˜์ด ์ถœ๋ ฅํ•˜๊ธฐQ. ๋จธ์“ฑ์ด๋Š” ์„ ์ƒ๋‹˜์ด ๋ช‡ ๋…„๋„์— ํƒœ์–ด๋‚ฌ๋Š”์ง€ ๊ถ๊ธˆํ•ด์กŒ์Šต๋‹ˆ๋‹ค. 2022๋…„ ๊ธฐ์ค€ ์„ ์ƒ๋‹˜์˜ ๋‚˜์ด age ๊ฐ€ ์ฃผ์–ด์งˆ ๋•Œ,์„ ์ƒ๋‹˜์˜ ์ถœ์ƒ ์—ฐ๋„๋ฅผ return ํ•˜๋Š” solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”.A.def solution(age): answer = 0 answer = 2022 - age while age: answer += 1 return answer ์ฒ˜์Œ์— ์ฝ”๋“œ๋ฅผ ์งฐ์„ ๋•Œwhile๋ฌธ์„ ์‚ฌ์šฉํ•˜์—ฌ์„œ ์ฝ”๋“œ๋ฅผ ์งœ๋ดค๋Š”๋ฐ,๋ญ”๊ฐ€ if๋ฌธ์œผ๋กœ๋„ ์ฝ”๋“œ ์งœ๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์„œif๋ฌธ ์ฝ”๋“œ๋„ ๋“ค๊ณ ์™€๋ด„def solution(age): answer = 0 answer = 2022 - age if age == age: answer += 1 r..