In this post I will give some algorithm problem from Google OA as well as Leetcode and my thoughts on them.
Our main problem here will be the OA problem appeared in the OA practice of Google Intern 2020 Online Assesment.
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.
Write a function that, given a non-empty array
N integers, denoting the heights of the students, returns the minimum number of rows created.