URLμ λΈλΌμ°μ μ μ
λ ₯νμ λ μΌμ΄λλ κ³Όμ μ λ₯νκ² μμ보μ! 1. URL νμ±λΈλΌμ°μ λ μ
λ ₯λ URLμ ν΄μνμ¬ νλ‘ν μ½ / λλ©μΈ λ€μ / κ²½λ‘ / 쿼리 맀κ°λ³μ λ±μΌλ‘ λΆλ¦¬νλ€.λΈλΌμ°μ λ URLμμ example.com μ΄λΌλ λλ©μΈ λ€μμ μΆμΆνκ³ μ΄λ₯Ό ν΅ν΄ DNS μΏΌλ¦¬κ° μμλλ€. 2. DNS (Domain Name System) μ‘°νDomain Nameμ μ¬λμ΄ μ΄ν΄νκΈ° μ¬μ΄ μ£Όμμ§λ§, μ»΄ν¨ν°λ IP μ£Όμλ₯Ό ν΅ν΄ ν΅μ νλ€.DNSλ λλ©μΈ λ€μμ IPλ‘ λ³ννκΈ° μν΄ μ‘΄μ¬νλ€. μΉ λΈλΌμ°μ λ DNS μλ²μ κ²μνκΈ° μ μ μΊμ±λ DNS κΈ°λ‘μ λ¨Όμ νμΈνλ€.μΊμμ ν΄λΉ μ λ³΄κ° μλ€λ©΄, λΈλΌμ°μ λ λλ©μΈμ IP μ£Όμλ‘ λ³ννκΈ° μν΄ DNS μλ²μ μμ²μ 보λΈλ€. μ΄ μμ²μ μ¬μ©μμ ISP(In..
ν°μ€ν 리μ±λ¦°μ§
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.Implement the MinStack class:- MinStack() initializes the stack object.- void push(int val) pushes the element val onto the stack.- void pop() removes the element on the top of the stack.- int top() gets the top element of the stack.- int getMin() retrieves the minimum element in the stack.You must i..
Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each row must contain the digits 1-9 without repetition.Each column must contain the digits 1-9 without repetition.Each of the nine 3 x 3 sub-boxes of the grid must contain the digits 1-9 without repetition.Note:A Sudoku board (partially filled) could be valid but is not necess..
Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.You must write an algorithm that runs in O(n) time.longest consecutive sequenceλ₯Ό μ°Ύλ λ¬Έμ ! O(n) μμΌλ‘ νμ΄μΌ νλ€.μ£Όμν μ μ constraintsμ numsμ lengthκ° 0λΆν° κ°λ₯νλ€λ κ² Hash Setμ μ΄μ©ν νμ΄class Solution: def longestConsecutive(self, nums: List[int]) -> int: numSet = set(nums) longest = 0 f..
A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.Given a string s, return true if it is a palindrome, or false otherwise.μ ν¨ν palindrome(νλ¬Έ) κ²μ¬νλ λ©μλ ꡬννκΈ°! νμ΄1: Reverse Stringclass Solution: def isPalindrome(self, s:..
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of brackets.Open brackets must be closed in the correct order.Every close bracket has a corresponding open bracket of the same type.κ΄νΈκ° μ¬λ°λ₯΄κ² μ§μ§μ΄μ‘λμ§ νμΈνλ λ¬Έμ ! νμ΄1: Stack μ΄μ©class Solution: def isValid(sel..
μ λ€λ¦(Generic)μ΄λ?Cλ μλ° κ°μ μ μ μΈμ΄μμ λ€μν νμ
κ°μ μ¬μ¬μ©μ±μ λμ΄κΈ° μν΄ μ¬μ©νλ λ¬Έλ²μ΄λ€. νμ
μ€ν¬λ¦½νΈλ μ μ νμ
μ κ°μ§λ―λ‘ μ λ€λ¦ λ¬Έλ²μ μ§μνλ€.μ λ€λ¦μ μ¬μ μ μλ―Έλ μΌλ°μ μΈ κ²(general)μ λ»νλλ°, νμ
μ€ν¬λ¦½νΈμ μ λ€λ¦λ μ΄μ λΉμ·νκ² 'μΌλ°νλ λ°μ΄ν°' νμ
μ΄λΌ λ³Ό μ μλ€.μ λ€λ¦: ν¨μ, νμ
, ν΄λμ€ λ±μμ λ΄λΆμ μΌλ‘ μ¬μ©ν νμ
μ 미리 μ ν΄λμ§ μκ³ νμ
λ³μλ₯Ό μ¬μ©ν΄μ ν΄λΉ μμΉλ₯Ό λΉμ λ λ€μμ, μ€μ λ‘ κ·Έ κ°μ μ¬μ©ν λ μΈλΆμμ νμ
λ³μ μ리μ νμ
μ μ§μ νμ¬ μ¬μ©νλ λ°©μ-> μ΄λ κ² νλ©΄ ν¨μ, νμ
, ν΄λμ€ λ± μ¬λ¬ νμ
μ λν΄ νλνλ λ°λ‘ μ μνμ§ μμλ λκΈ° λλ¬Έμ μ¬μ¬μ©μ±μ΄ ν¬κ² ν₯μλλ€.νμ
λ³μλ μΌλ°μ μΌλ‘ μ κ°μ΄ κΊΎμ κ΄νΈ λ΄λΆμ..
Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.λΉλμκ° λμ μμλλ‘, μμ kκ°μ elementsλ₯Ό μΆλ ₯νλ λ¬Έμ λ€. νμ΄ 1class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: count = defaultdict(int) for i in nums: count[i] += 1 result = sorted(count, key=count.get, reverse=Tr..