목록2023/08 (39)
넘치게 채우기
https://leetcode.com/problems/minimum-number-of-taps-to-open-to-water-a-garden/description/ Minimum Number of Taps to Open to Water a Garden - LeetCode Can you solve this real interview question? Minimum Number of Taps to Open to Water a Garden - There is a one-dimensional garden on the x-axis. The garden starts at the point 0 and ends at the point n. (i.e The length of the garden is n). There a..
https://leetcode.com/problems/summary-ranges/description/?envType=study-plan-v2&envId=top-interview-150 Summary Ranges - LeetCode Can you solve this real interview question? Summary Ranges - You are given a sorted unique integer array nums. A range [a,b] is the set of all integers from a to b (inclusive). Return the smallest sorted list of ranges that cover all the numbers in the arr leetcode.co..
https://leetcode.com/problems/minimum-penalty-for-a-shop/description/ Minimum Penalty for a Shop - LeetCode Can you solve this real interview question? Minimum Penalty for a Shop - You are given the customer visit log of a shop represented by a 0-indexed string customers consisting only of characters 'N' and 'Y': * if the ith character is 'Y', it means that cust leetcode.com 문제 유형 : 구간 합(Prefix ..
https://leetcode.com/problems/valid-sudoku/description/?envType=study-plan-v2&envId=top-interview-150 Valid Sudoku - LeetCode Can you solve this real interview question? Valid Sudoku - Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: 1. Each row must contain the digits 1-9 without repetition. 2. Each c leetcode.com 문제 유형 : 2..
https://leetcode.com/problems/valid-anagram/description/?envType=study-plan-v2&envId=top-interview-150 Valid Anagram - LeetCode Can you solve this real interview question? Valid Anagram - Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using leetcode.com ..
입출력 팁 import java.io.*; public class FastIOExample { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out)); // 문자열로 읽고 출력하기 String inputLine = reader.readLine(); writer.write("입력 받은 문자열: " + inputLine); // 숫자로 읽고 출력하기 int num = Integer..
https://leetcode.com/problems/interleaving-string/description/ Interleaving String - LeetCode Can you solve this real interview question? Interleaving String - Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2. An interleaving of two strings s and t is a configuration where s and t are divided into n and m subs leetcode.com 문제 유형 : 문자열 처리 / 동적 계획법 문제 난이도 : M..
입출력 import sys sys.stdin.readline() # 한줄 전체 입력받기. input()보다 빠르게 입력받을 수 있다. 개행문자 \n도 딸려오니 주의. a, b, c = map(int, sys.stdin.readline().split()) # a, b, c에 각각 넣기 형변환 int(x) # int로 변환 str(x) # 문자열로 변환 float(x) # 실수 타입 변환 chr(x) # 문자로 변환 bool(x) # 참/거짓값으며 변환(0이나 null이 아닌경우 모두 True) 수학 1e9 = 10^9 2e9 = 2 * 1e9 (INT_MAX에 거의 근접한 값이다) 1e9 + 7 # 보통 온라인 저지 사이트나 알고리즘 대회에서 값이 너무 커질 때, 오버플로우를 막기 위해서 1e9 + 7로 ..
https://leetcode.com/problems/longest-substring-without-repeating-characters/description/?envType=study-plan-v2&envId=top-interview-150 int: n = len(s) maxLen = 0 left = 0 charSet = set() for right in range(n): while s[right] in charSet: charSet.remove(s[left]) left += 1 charSet.add(s[right]) maxLen = max(maxLen, right - left + 1) return maxLen Java class Solution { public int lengthOfLongestSub..
https://leetcode.com/problems/excel-sheet-column-title/description/ Excel Sheet Column Title - LeetCode Can you solve this real interview question? Excel Sheet Column Title - Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... Example 1: I leetcode.com 문제 유형 : 문자열 처리 문제 난이도 : Eas..