We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
길이가 정해진 윈도우를 만들어서, 옆으로 한칸 밀면서 연산해 가는 것
예) 연속된 N 일 동안 최대 매출 기록 구하기
func solution(_ input: [Int], K: Int) -> Int { var answer = Array(input[0..<K]).reduce(0, +) var sum = answer for i in K..<input.count { sum += input[i] - input[i-K] answer = max(answer, sum) } return answer } // 56 solution([12, 15, 11 ,20, 25, 10, 20, 19, 13, 15], K: 3)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
예) 연속된 N 일 동안 최대 매출 기록 구하기
The text was updated successfully, but these errors were encountered: