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
Which of the following information is okay to share on social networking site?
zvonat [6]
C. Your hobbies and interests
4 0
3 years ago
Read 2 more answers
A new object of type list is created for each recursive invocation of f.A. TrueB. False
sammy [17]

Answer:

True but double check!

7 0
3 years ago
Meeting code =nve-hmqq-qxr<br>​
valentina_108 [34]
Uhhhh meeting code for what
7 0
3 years ago
Read 2 more answers
A _____ is a control that tells the computer what task to perform.
sammy [17]
I'm pretty sure the answer is code
7 0
4 years ago
Which of the following best describes the primary function of software applications?
e-lub [12.9K]
The answer is that it is to perform specific operations for various applications. These functions include writing reports, creating spreadsheets, manipulating images, keeping records and developing websites and calculating expenses.
7 0
3 years ago
Read 2 more answers
Other questions:
  • The most widely used presentation software program is Microsoft PowerPoint. You can produce a professional and memorable present
    5·1 answer
  • How people have contributed to the advancement of science
    7·1 answer
  • Which system tool allows you to manage the available space on your hard disk to improve efficiency? A. ScanDisk B. Anti-Virus C.
    10·1 answer
  • Which of these engine components forms a tight seal between the piston and the cylinder and is necessary for proper engine opera
    13·2 answers
  • A posting error is:
    8·1 answer
  • Which of the following represent features of free software licensing? Check all of the boxes that apply.
    10·1 answer
  • The visitor's age is stored in the variable age, the day of the week is stored in a variable day, and the price in dollars is st
    8·1 answer
  • How many of these imformation have you shared​
    14·1 answer
  • Which layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for delivering data between two
    12·1 answer
  • 2. Explain the difference between a JMP instruction and CALL instruction
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!