[LeetCode] Minimize Length of Array Using Operations

1 · · Jan. 21, 2024, 5:39 a.m.
3012. Minimize Length of Array Using Operations You are given a 0-indexed integer array nums containing positive integers. Your task is to minimize the length of nums by performing the following operations any number of times (including zero): Select two distinct indices i and j from nums, such that nums[i] > 0 and nums[j] > 0. Insert the result of nums[i] % nums[j] at the end of nums. Delete the elements at indices i and j from nums. Return an integer denoting the minimum length of nums afte...