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
Write a program which:
Studentka2010 [4]

Answer:

Ill do this in C# and Java

Explanation:

C#:

public static void Main(string[] args)

       {

           string input = Console.ReadLine();

               switch (input)

               {

                   case "A1":

                       Console.WriteLine("Footwear:");

                       Console.WriteLine("Shoes");

                       break;

                   case "B1":

                       Console.WriteLine("Tops:");

                       Console.WriteLine("Jackets");

                       break;

                   case "C1":

                       Console.WriteLine("Pants:");

                       Console.WriteLine("Trousers");

                       break;

                   case "A2":

                       Console.WriteLine("Footwear:");

                       Console.WriteLine("Trainers");

                       break;

                   case "B2":

                       Console.WriteLine("Tops:");

                       Console.WriteLine("TShirts");

                       break;

                   case "C2":

                       Console.WriteLine("Pants:");

                       Console.WriteLine("Shorts");

                       break;

                   default:

                       Console.WriteLine("Incorrect Input");

                       break;

               }

       }

Java:

public static void main(String[] args)

   {

       Scanner myObj = new Scanner(System.in);  // Create a Scanner object

       String input = myObj.nextLine();

       {

           switch (input)

               {

                   case "A1":

                       System.out.println("Footwear:");

                       System.out.println("Shoes");

                       break;

                   case "B1":

                       System.out.println("Tops:");

                       System.out.println("Jackets");

                       break;

                   case "C1":

                       System.out.println("Pants:");

                       System.out.println("Trousers");

                       break;

                   case "A2":

                       System.out.println("Footwear:");

                       System.out.println("Trainers");

                       break;

                   case "B2":

                       System.out.println("Tops:");

                       System.out.println("TShirts");

                       break;

                   case "C2":

                       System.out.println("Pants:");

                       System.out.println("Shorts");

                       break;

                   default:

                       System.out.println("Incorrect Input");

                       break;

               }

       }

3 0
3 years ago
All animations on the world wide web are flash animations
natima [27]

Not every animation on the web is Flash but currently the majority is. There exists simple GIF based animations as well as other technologies for animation such as Silverlight and HTML5. Most believe HTML5 will eventually replace Flash.

6 0
3 years ago
Read 2 more answers
Choose all that apply.
stiks02 [169]

Answer:

choose all that apply

Explanation:

7 0
3 years ago
Area on a computer screen where<br> you perform work
raketka [301]

Answer:

Screen or monitor, it may be also the central processing unit (CPU) where you manage your computers actions

brainliest please ;)

3 0
3 years ago
What do you mean by algorithm​
Snowcat [4.5K]

A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Can you subnet the 172.16.128.0/17 network address to support this subnet?
    6·1 answer
  • What is the correct order of network types when categorized by their size or the physical area they cover, from largest to small
    10·1 answer
  • Because log-on procedures may be cumbersome and tedious, users often store log-on sequences in their personal computers and invo
    6·1 answer
  • ABC software company is to develop software for effective counseling for allotment of engineering seats for students with high s
    13·1 answer
  • Name similarities between innovation and invention
    6·1 answer
  • To implement the various placement algorithms discussed for dynamic partitioning (see Section 7.2 ), a list of the free blocks o
    11·1 answer
  • How many of yall are willing too sub to my channel called "Space Juice" with around 200 subs?!​
    6·1 answer
  • Write a public static method named evens that takes in 1 argument int a, and returns a String containing all positive even numbe
    8·1 answer
  • Who play fortnite gameeeeeeee
    14·1 answer
  • Plsss help me plsssssss
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!