๋ชฉ๋ก๋ฐฐ์—ด์˜์œ ์‚ฌ๋„ (1)

๐Ÿค ์€์ง€log ๐Ÿค

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค:Javascript] ๋ฐฐ์—ด์˜ ์œ ์‚ฌ๋„

ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค Lv.0 - ๋ฐฐ์—ด์˜ ์œ ์‚ฌ๋„ ๐Ÿ’š ๋ฌธ์ œ์„ค๋ช… ๋‘ ๋ฐฐ์—ด์ด ์–ผ๋งˆ๋‚˜ ์œ ์‚ฌํ•œ์ง€ ํ™•์ธํ•ด๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด ๋ฐฐ์—ด s1๊ณผ s2๊ฐ€ ์ฃผ์–ด์งˆ ๋•Œ ๊ฐ™์€ ์›์†Œ์˜ ๊ฐœ์ˆ˜๋ฅผ returnํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”. ๐Ÿ’š ์ œํ•œ์กฐ๊ฑด 1 ≤ s1, s2์˜ ๊ธธ์ด ≤ 100 1 ≤ s1, s2์˜ ์›์†Œ์˜ ๊ธธ์ด ≤ 10 s1๊ณผ s2์˜ ์›์†Œ๋Š” ์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž๋กœ๋งŒ ์ด๋ฃจ์–ด์ ธ ์žˆ์Šต๋‹ˆ๋‹ค s1๊ณผ s2๋Š” ๊ฐ๊ฐ ์ค‘๋ณต๋œ ์›์†Œ๋ฅผ ๊ฐ–์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๐Ÿ’š ํ’€์ด function solution(s1, s2) { const answer = s1.filter(x => s2.includes(x)) return answer.length; } โœ… ๋‘๊ฐœ์˜ ๋ฐฐ์—ด์„ ๋น„๊ตํ•˜๊ณ  ๊ทธ์•ˆ์— ๊ฐ™์€ ๊ฐ’์ด ์žˆ๋Š”์ง€ ํ™•์ธํ›„ ๊ฐœ์ˆ˜๋กœ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๋‹ค. ๊ฒ€์ƒ‰์œผ๋กœ filter(..