
1551. Minimum Operations to Make Array Equal
·
Algorithm
Minimum Operations to Make Array Equal - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 정수가 N이 주어진다. 1부터 시작하는 홀수 N개의 배열 arr에 대해서 아래 연산 법을 사용할 수 있다. 연산 법 len를 arr의 길이, 0 int: return n * n // 4 이 문제는 수의 성질을 이용하면 O(1)로 해결할 수 있는 문제다. 홀수인 경우 n = 7이라면 arr = [1, 3, 5, 7, 9, 11, 13]이다. 결국..