smithmorgan773p35885
03.11.2020 •
Computers and Technology
Bruh why is everyone skipping my question
Solved
Show answers
More tips
- A Auto and Moto How many blood alcohol level units are allowed in Russian traffic laws?...
- G Goods and services Kogda zhdatt Iphone 5? The Latest News and Rumors...
- F Family and Home Parquet or laminate, which is better?...
- L Leisure and Entertainment How to Properly Wind Fishing Line onto a Reel?...
- L Leisure and Entertainment How to Make a Paper Boat in Simple Steps...
- T Travel and tourism Maldives Adventures: What is the Best Season to Visit the Luxurious Beaches?...
- H Health and Medicine Kinesiology: What is it and How Does it Work?...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
- L Leisure and Entertainment History of International Women s Day: When Did the Celebration of March 8th Begin?...
- S Style and Beauty Intimate Haircut: The Reasons, Popularity, and Risks...
Answers on questions: Computers and Technology
- E English Use the following passage to answer the question. (1) water is something most of us take for granted. (2) if we need a cold drink or want to take a shower, water is...
- M Mathematics Find the slope of the hill. please help...
- E English In the count of monte cristo, how does the noise in the wall affect edmond dantes? *it causes him to summon the jailer. it gives him a sense of hope. it frightens...
- E English One of the keys to gaining self esteem is to...
Ответ:
I keep having the same problem and my questions get answered like a year LATER its messed up.
Explanation:
Ответ:
Answer is in java language
Explanation:
Java Code
public class Compress{
public static void main(String []args){
int[] array=new int[]{1 ,1 ,3 ,3, 3, 2, 2, 2, 2, 14, 14, 14, 11, 11, 11, 2};
int currentNumber=array[0];
int count=1;
for(int i=1;i <array.length;i++){
if(currentNumber != array[i]){
System.out.print(count+" " +currentNumber+" ");
currentNumber=array[i];
count=1;
} else{
count++;
}
}
System.out.print(count+" " +currentNumber+" ");
}
}
Code Explanation
First create two variables which will hold the current number and its count and then iterate over every element in array. If current index value is different from currentNumber variable then display the previous calculated number value and its count and then change the value to current index of array.
At the end display the last calculated value.
Example
Answer will look like below
2 1 3 3 4 2 3 14 3 11 1 2