1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ANTONII [103]
3 years ago
5

c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive

by one, sequentially (as their heights appear in A). For the i-th student, if there is a row in which all the students are taller than A[i], the student will stand in one of such rows. If there is no such row, the student will create a new row. Your task is to find the minimum number of rows created.
Computers and Technology
1 answer:
Lilit [14]3 years ago
4 0

The below code will help you to solve the given problem and you can execute and cross verify with sample input and output.

#include<stdio.h>

#include<string.h>

 int* uniqueValue(int input1,int input2[])

 {

   int left, current;

   static int arr[4] = {0};

   int i      = 0;

     for(i=0;i<input1;i++)

      {

         current = input2[i];

         left    = 0;

         if(current > 0)

         left    = arr[(current-1)];

      if(left == 0 && arr[current] == 0)

       {

       arr[current] = input1-current;

       }

       else

   {

       for(int j=(i+1);j<input1;j++)

       {

           if(arr[j] == 0)

           {

               left = arr[(j-1)];

               arr[j] = left - 1;

           }

       }

   }

}

return arr;

}

You might be interested in
1. Write an expression whose value is the result of converting the str value associated with s to an int value. So if s were ass
maksim [4K]

Answer:

The solution or expression for each part is given below:

  1. int(s)
  2. s[len(s)-1]
  3. last.capitalize()+','+first.capitalize()
  4. str(x)
  5. s[5:]

Explanation:

Following are attached the images that show how these expressions will be used. I hope they will make the concept clear.

All the images below are respective to the questions given.

7 0
3 years ago
Waterpower was first harvested by ancient societies using
Maslowich
Not sure why this question is in Computers and Technology...

Answer should be c.
6 0
3 years ago
Explain approaches of AI​
Umnica [9.8K]
A-artificial I-intelligent
5 0
2 years ago
Read 2 more answers
Which component is a part of the CPU of a computer
Marina CMI [18]
Is a piece of hardware that carries out the instructions of a computer program. It performs the basic arithmetical, logical, and input/output operations of a computer system.
Hope it helps!!
6 0
3 years ago
Read 2 more answers
What are personal skills?
jok3333 [9.3K]

Answer:

Basically what you are good at

Explanation:

5 0
3 years ago
Other questions:
  • Windows explorer has a pane located on the left side which can display the directory structure of one or more drives. what is th
    15·1 answer
  • In 125 words describe the steps to active listening.
    6·1 answer
  • What are the basic tools for coding HTML manually?
    10·2 answers
  • For each of these statements find a domain for which the statement is true and a domain for which the statement is false. a) Eve
    13·1 answer
  • Consider two communication technologies that use the same bandwidth, but Technology B has twice the SNR of technology A. If tech
    14·1 answer
  • The default for automatic replies in outlook is what?
    6·2 answers
  • Clasifica los documentos comerciales en activo, pasivo o patrimonial para cada operacion:
    14·1 answer
  • Write the two features of a mouse.​
    9·1 answer
  • What are some examples of productions categorized as non-broadcast productions?
    6·1 answer
  • Please help!!
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!