https://github.com/letsdeepchat/equality-in-array
Given an array of integers, determine the minimum number of elements to delete to leave only elements of equal value. Example arr= [1,2,2,3] Delete the 2 elements 1 and 3 leaving arr as [2,2]. If both twos plus either the 1 or the 3 are deleted, it takes 3 deletions to leave either [3] or [1]. The minimum number of deletions is . 2 Input Format The first line contains an integer n, the number of elements in arr. The next line contains n space-separated integers arr[i]. Constraints 0<n<=100 1<=arr[i]<=100 Sample Input 5 3 3 2 1 3
https://github.com/letsdeepchat/equality-in-array
Last synced: 2 months ago
JSON representation
Given an array of integers, determine the minimum number of elements to delete to leave only elements of equal value. Example arr= [1,2,2,3] Delete the 2 elements 1 and 3 leaving arr as [2,2]. If both twos plus either the 1 or the 3 are deleted, it takes 3 deletions to leave either [3] or [1]. The minimum number of deletions is . 2 Input Format The first line contains an integer n, the number of elements in arr. The next line contains n space-separated integers arr[i]. Constraints 0<n<=100 1<=arr[i]<=100 Sample Input 5 3 3 2 1 3
- Host: GitHub
- URL: https://github.com/letsdeepchat/equality-in-array
- Owner: letsdeepchat
- Created: 2021-11-11T03:49:23.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-08T04:07:22.000Z (over 4 years ago)
- Last Synced: 2025-02-12T15:41:46.369Z (about 1 year ago)
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Equality-in-Array
Given an array of integers, determine the minimum number of elements to delete to leave only elements of equal value. Example arr= [1,2,2,3] Delete the 2 elements 1 and 3 leaving arr as [2,2]. If both twos plus either the 1 or the 3 are deleted, it takes 3 deletions to leave either [3] or [1]. The minimum number of deletions is . 2 Input Format The first line contains an integer n, the number of elements in arr. The next line contains n space-separated integers arr[i]. Constraints 0<n<=100 1<=arr[i]<=100 Sample Input 5 3 3 2 1 3
# Equality-in-Array
Given an array of integers, determine the minimum number of elements to delete to leave only elements of equal value. Example arr= [1,2,2,3] Delete the 2 elements 1 and 3 leaving arr as [2,2]. If both twos plus either the 1 or the 3 are deleted, it takes 3 deletions to leave either [3] or [1]. The minimum number of deletions is . 2 Input Format The first line contains an integer n, the number of elements in arr. The next line contains n space-separated integers arr[i]. Constraints 0<n<=100 1<=arr[i]<=100 Sample Input 5 3 3 2 1 3
Equality in Array
Given an array of integers, determine the minimum number of elements to delete to leave only elements of equal value.
Example
arr= [1,2,2,3]
Delete the 2 elements 1 and 3 leaving arr as [2,2]. If both twos plus either the 1 or the 3 are deleted, it takes 3 deletions to leave either [3] or [1]. The minimum number of deletions is . 2
Input Format
The first line contains an integer n, the number of elements in arr. The next line contains n space-separated integers arr[i].
Constraints
0