카테고리: leetcode

릿코드 Partition Labels

1. partition labels 1.1. 컴퓨팅적 사고 (1)LastIdx[알파벳을 아스키코드로 표현된 값] = 현재 위치의 값을 구해줍니다. 예) ‘c’ 일 경우 LastIdx[‘c’-‘a’=2] = 현재 위치(i) (2) S문자열을 모두 수행하면서 나오는 알파벳들의 위치와 비교하여 최대로 위치해있는 인덱스값을 구해줍니다. (3) 만약 S문자열값을

릿코드 Trapping Rain Water

1. leetcode Trapping Rain Water 1.1. 컴퓨팅적 사고 해당 문제는 릿코드 Hard 난이도 문제이며 비가 내린후 빗물의 컨테이너에 채워지는 빗물의 양을 구하는 문제입니다. (1) 왼쪽에 가장 작은 인덱스와 오른쪽 가장 큰 인덱스와 모든 빗물중에 가장 큰 인덱스도 구해줍니다. 그 이유는 왼쪽인덱스~빗물양이 가장 큰 인덱스, 오른

릿코드 Search Insert Position

1. 릿코드 search insert position 2. 문제 Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inser

릿코드 Maximal Square

1. leetcode maximal square 1.1. 문제 Given an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. 1.1.1. Example 1: Input: matrix = [[“1”,“0

릿코드 Single Number

1. 릿코드 leetcode Single Number 2. 문제 Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. Follow up: Could you implement a solution with a line

릿코드 Decode String

1. 릿코드 Decode String Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times

릿코드 Longest Common Prefix

1. 릿코드 leetcode Longest Common Prefix 2. 문제 Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”. 2.1. Exa

릿코드 Valid Parentheses

1. 릿코드 leetcode ValidParentheses 2. 문제 Given a string s containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. 2.1. An input string is valid if: Ope

릿코드 maximum subarray

1. 릿코드 maximum-subarray 2. 문제 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Follow up: If you have figured