Minimum Deletions to Make Array Beautiful
Given a 0-indexed integer array nums, the array is considered beautiful if:
- nums.length is even.
- nums[i] != nums[i + 1] for all i % 2 == 0.
Note that an empty array is considered beautiful.
The task is to find and print the minimum number of elements to delete from nums to make it beautiful.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)