Search

ํ—ˆ์ง„ํ˜

2.๋ฌธ์ œ์ด๋ฆ„
3. ์ˆ˜ํ–‰์‹œ๊ฐ„[์ดˆ(s)]
900
์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ
์ข‹์•„์š” ์ˆ˜
: 0
5 more properties
| ์ฝ”๋“œ ์ž‘์„ฑํ•˜๊ธฐ
def solution(A, B): answer = 0 A.sort() B.sort() idx = 0 for i in range(len(B)): if A[idx] < B[i]: # print(f"a<b, i={i},idx={idx}") answer += 1 idx += 1 return answer
Python
๋ณต์‚ฌ
| ์ฝ”๋“œ ์„ค๋ช…ํ•˜๊ธฐ
1.
๋‘ ๋ฐฐ์—ด์„ ์ •๋ ฌํ•œ๋‹ค
2.
๋‘ ๊ฐœ์˜ ์ธ๋ฑ์Šค๋ฅผ ์ƒ๊ฐํ•œ๋‹ค.
a.
B์˜ ์ธ๋ฑ์Šค๋Š” for๋ฌธ์„์— ์žˆ๋Š” i๋ฅผ ์‚ฌ์šฉ
b.
A์˜ ์ธ๋ฑ์Šค๋Š” idx๋ฅผ ์‚ฌ์šฉ
c.
B์˜ ๊ฐ’์ด A์˜ ๊ฐ’๋ณด๋‹ค ํด ๊ฒฝ์šฐ์—๋งŒ A์˜ idx๋ฅผ ์˜ฌ๋ ค์ค€๋‹ค.