user-img
์ž๋ฃŒ๊ตฌ์กฐ 1
thumbnail
Programmers ๋‰ด์Šค ํด๋Ÿฌ์Šคํ„ฐ๋ง java ํ’€์ด
1. ๋ฌธ์ œ ์„ค๋ช…๋ฌธ์ œ ๋งํฌ2. ์ ‘๊ทผ ๋ฐฉ์‹(1) HashSet์— ๋‚˜์˜ค๋Š” ๋ชจ๋“  ๋ถ€๋ถ„ ๋ฌธ์ž์—ด์„ ์ €์žฅํ•œ๋‹ค. (2) map1 , map2๋Š” HashMap์œผ๋กœ์„œ ๊ฐ ๋ฌธ์ž์—ด์˜ ๋ฌธ์ž๊ฐ€ key, ๊ทธ ๋ฌธ์ž๊ฐ€ ๋‚˜์˜ค๋Š” ๊ฐœ์ˆ˜๊ฐ€ value์ด๋‹ค. (3) hashSet์— ์ €์žฅ๋˜์–ด ์žˆ๋Š” ๋ฌธ์ž๋ฅผ ํ•˜๋‚˜์”ฉ ๊บผ๋‚ธ๋‹ค. ํ•ด๋‹น ๋ฌธ์ž์˜ ๊ฐœ์ˆ˜๋ฅผ map1๊ณผ map2์—์„œ ๊บผ๋‚ด์„œ, ํ•ฉ์ง‘ํ•ฉ๊ณผ ๊ต์ง‘ํ•ฉ์„ ๊ณ„์‚ฐํ•œ๋‹ค.ํ•ฉ์ง‘ํ•ฉ: ๋‘˜ ์ค‘ ๋” ๊ฐœ์ˆ˜๊ฐ€ ๋งŽ์€ ์ชฝ์˜ ๊ฐœ์ˆ˜๋ฅผ ๋”ํ•œ๋‹ค.๊ต์ง‘ํ•ฉ: ๋‘˜ ์ค‘ ํ•˜๋‚˜๋ผ๋„ ๊ฐ’์ด ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด ๋„˜์–ด๊ฐ„๋‹ค. ๋‘˜ ๋‹ค ํ•ด๋‹น ๊ฐ’์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค๋ฉด ๊ฐœ์ˆ˜๊ฐ€ ๋” ์ ์€ ์ชฝ์˜ ๊ฐœ์ˆ˜๋ฅผ ๋”ํ•œ๋‹ค.3. ์ฝ”๋“œ ๋ถ„์„import java.io.*;import java.util.*;class Solution { public int solution(String str1, St..
2024.08.08
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด