[LeetCode] Maximum Subarray (javascript)
문제 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. A subarray is a contiguous part of an array. 문제[번역] 정수 숫자열이 주어집니다. 최소 하나의 숫자를 포함한 연속적 최대 합을 구하세요 Example 1 Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output: 6 Explanation: [4,-1,2,1] has the largest sum = 6. Example 2 Input: nums = [1] Output: 1 Example 3 Input:..
2022. 3. 7.
[LeetCode] Valid Parentheses (javascript)
문제 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. 문제[번역] '(', ')', '{', '}', '[' ,']'를 포함한 문자열이 주어집니다. 문자열이 유효한지 평가하세요. 1. 열린괄호는 같은괄호로 닫혀야함. 2. 열린 괄호는 순서대로 닫혀야함. Example 1 Input: s = "(..
2021. 12. 27.