diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/4065. Rearrange Array by Removing Distinct Values.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/4065. Rearrange Array by Removing Distinct Values.java" new file mode 100644 index 00000000..b7b59632 --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/4065. Rearrange Array by Removing Distinct Values.java" @@ -0,0 +1,26 @@ +class Solution { + public int[] rearrangeArray(int[] nums) { + // 오름차 순이어야함 + // 연속 같은 수 금지 + + // 숫자 범위 1 ~ 100 + int[] cnt = new int[101]; + int[] ans = new int[nums.length]; + + for(int i=0; i0) { + ans[pos++] = j; + cnt[j]--; + } + if(pos == nums.length) break; + } + } + + return ans; + } +} \ No newline at end of file