본문 바로가기
알고리즘 풀이

231022 LeetCode 문제 풀이

by 미노킴 2023. 10. 23.

1793. Maximum Score of a Good Subarray

https://leetcode.com/problems/maximum-score-of-a-good-subarray/?envType=daily-question&envId=2023-10-22

 

1) 문제 설명

You are given an array of integers nums (0-indexed) and an integer k.

The score of a subarray (i, j) is defined as min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1). A good subarray is a subarray where i <= k <= j.

Return the maximum possible score of a good subarray.

 

2) 제한 사항

  • 1 <= nums.length <= 105
  • 1 <= nums[i] <= 2 * 104
  • 0 <= k < nums.length

 

3) 도전 과제

X

 

4) 풀이

231023 기준 풀이 x

 

5) 소스 코드 및 결과