๋ฐ์ํ ๋ถ๋ฅ ์ ์ฒด๋ณด๊ธฐ282 [Java] ์ ๊ท ํํ์ ์ฌ์ฉ๋ฐฉ๋ฒ (Pattern, Matcher) ๐ผ ์ ๊ทํํ์ ์์ฑ ๋ฐฉ๋ฒ ๐ผ ์ ๊ท ํํ์(Regular Expression) ์ด๋ ํน์ ํ ๊ท์น์ ๊ฐ์ง ๋ฌธ์์ด์ ์งํฉ์ ํํํ๊ธฐ ์ํด ์ฐ์ด๋ ํ์์ธ์ด ์ ๋๋ค. ์๋ฐ API java.util.regex ํจํค์ง๋ฅผ ์ฌ์ฉํด์ ์์ฑํ ์ ์์ต๋๋ค. โจPattern ํด๋์ค ์ ๊ท ํํ์์ ๋์ ๋ฌธ์์ด์ ๊ฒ์ฆํ๋ ๊ธฐ๋ฅ์ java.util.regex.Pattern ํด๋์ค์ matches() ๋ฉ์๋๋ฅผ ํ์ฉํ์ฌ ๊ฒ์ฆํ ์ ์์ต๋๋ค. matches() ๋ฉ์๋์ ์ฒซ๋ฒ์งธ ๋งค๊ฐ๊ฐ์ ์ ๊ทํํ์์ด๊ณ ๋๋ฒ์งธ ๋งค๊ฐ๊ฐ์ ๊ฒ์ฆ ๋์ ๋ฌธ์์ด์ ๋๋ค. ๊ฒ์ฆ ํ ๋์๋ฌธ์์ด์ด ์ ๊ทํํ์๊ณผ ์ผ์นํ๋ฉด true, ๊ทธ๋ ์ง ์๋ค๋ฉด false๊ฐ์ ๋ฆฌํดํฉ๋๋ค. import java.util.regex.Pattern; public class RegexExample {.. 2022. 4. 18. [LeetCode] 3. Longest Substring Without Repeating Characters Given a string s, find the length of the longest substring without repeating characters. Example 1: Input: s = "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: Input: s = "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3: Input: s = "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. Notice that the ans.. 2022. 4. 18. [Java] ์๋ฐ ์ ๊ทํํ์ ๋ชจ์ ๐ผ ์์ฃผ ์ฌ์ฉํ๋ ์ ๊ท ํํ์ ๐ผ ์ ๊ท ํํ์ ์ค๋ช ^[0-9]*$ ์ซ์ ^[a-zA-Z]*$ ์๋ฌธ์ ^[๊ฐ-ํฃ]*$ ํ๊ธ \\w+@\\w+\\.\\w+(\\.\\w+)? E-mail ^[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-z]+$ E-mail ^\d{2,3}-\d{3,4}-\d{4}$ ์ ํ๋ฒํธ ^01(?:0|1|[6-9])-(?:\d{3}|\d{4})-\d{4}$ ํด๋์ ํ๋ฒํธ \d{6}\-[1-4]\d{6} ์ฃผ๋ฏผ๋ฑ๋ก๋ฒํธ ^\d{3}-\d{2}$ ์ฐํธ๋ฒํธ ๐ผ ๋งค์นญ๋ ๋ฌธ์๋ฅผ ์ง์ /์ ์ธํ๋ ํํ์ ๐ผ ์ ๊ท ํํ์ ์ค๋ช [abc] a, b, c ์ค ํ๋์ด๋ฉด ์ผ์น [^abc] a, b, c ๋ฅผ ์ ์ธํ ๊ธ์ ์ด๋ฉด ์ผ์น [a-zA-z] a ๋ถํฐ z๊น์ง์ ์๋ฌธ์ ์ํ๋ฒณ ์ด๊ฑฐ๋ A ๋ถํฐ Z๊น์ง์ ๋๋ฌธ.. 2022. 4. 18. [SQLD] 30ํ ๊ธฐ์ถ ๋ฌธ์ ( 50๋ฌธ์ / ์ ๋ต,ํด์คํฌํจ ) ๐SQLD. ์ 30 ํ ๊ธฐ์ถ ๋ฌธ์ ๋ฌธ์ 1. ์๋ ๋ด์ฉ์ ํน์ง์ ๋ฌด์์ ์ค๋ช ํ๊ณ ์๋์ง ๊ณ ๋ฅด์์ค. ์ ๋ตํ์ธ๐ผ [ ์ค๋ช ] ์ํฐํฐ ๋ด์์ ์์ฑ์ ๋ํ ๋ฐ์ดํฐ ํ์ ๊ณผ ํฌ๊ธฐ ๊ทธ๋ฆฌ๊ณ ์ ์ฝ์ฌํญ์ ์ง์ ํ๋ ๊ฒ 1) ์ ์ฝ์กฐ๊ฑด 2) ๋๋ฉ์ธ 3) ์ ๊ทํ 4) ์๋ณ์ ๋ฌธ์ 2. ์๋์ ๋ฐ์ ๊ทํ์ ๋ํ ์ค๋ช ์ค ๋ถ์ ์ ํ ๊ฒ์? ์ ๋ตํ์ธ๐ผ 1) ๋ฐ์ดํฐ๋ฅผ ์กฐํํ ๋ ๋์คํฌ I/O ๋์ด ๋ง์์ ์ฑ๋ฅ์ด ์ ํ๋๊ฑฐ๋ ๊ฒฝ๋ก๊ฐ ๋๋ฌด ๋ฉ์ด ์กฐ์ธ์ผ๋ก ์ธํ ์ฑ๋ฅ์ ํ๊ฐ ์์๋ ๋ ์ํํ๋ค. 2) ์ปฌ๋ผ์ ๊ณ์ฐํ์ฌ ์ฝ์ ๋ ์ฑ๋ฅ์ด ์ ํ๋ ๊ฒ์ด ์์๋๋ ๊ฒฝ์ฐ ์ํํ๋ค. 3) ๋ฐ์ ๊ทํ๋ฅผ ์ ์ฉํ ๋๋ ๊ธฐ๋ณธ์ ์ผ๋ก ๋ฐ์ดํฐ ๋ฌด๊ฒฐ์ฑ์ด ๊นจ์ง ๊ฐ๋ฅ์ฑ์ด ๋ง์ด ์์ผ๋ฏ๋ก ๋ฐ๋์ ๋ฐ์ดํฐ ๋ฌด๊ฒฐ์ฑ์ ๋ณด์ฅํ ์ ์๋ ๋ฐฉ๋ฒ์ ๊ณ ๋ คํด์ผํ๋ค. 4) ๋ฐ์ ๊ทํ ์ ์ ํ ์ด๋ธ ์ถ๊ฐ(ํต๊ณ.. 2022. 4. 17. [LeetCode] 58. Length of Last Word 58. Length of Last Word Given a string s consisting of some words separated by some number of spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-space characters only. Example 1: Input: s = "Hello World" Output: 5 Explanation: The last word is "World" with length 5. Example 2: Input: s = " fly me to the moon " Output: 4 Explanation: The last.. 2022. 4. 17. [LeetCode] 9. Palindrome Number ๐๋ฌธ์ . ์ซ์๊ฐ ์ ๋ ฅ๋๋ฉด ํด๋น ์ซ์๊ฐ ํฐ๋ฆฐ๋๋กฌ์ด๋ฉด true, ์๋๋ฉด false ๋ฅผ ์ถ๋ ฅํ์ธ์. Given an integer x, return true if x is palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, 121 is a palindrome while 123 is not. Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from left to right and from right to left. Example 2: Input: x = -121 Output: false Explanatio.. 2022. 4. 17. ์ด์ 1 ยทยทยท 21 22 23 24 25 26 27 ยทยทยท 47 ๋ค์ 300x250