Question 1:
Given an array of integers (vector of ints), the index represents a student ID and the corresponding value is that student's score on the exam. The grading criteria are as follows: failed
- < 50%: failed
- 50% <= score <= 80%: regular pass
-
80%: pass with distinction
Return an array of 3 elements, representing the number of students who failed, the number with a regular pass, and the number with a distinction pass.
Question 2:
You want to read the chapters of a book. You are given an array time that represents time, where the index represents a day and the corresponding value is the time you have available for reading that day. You are also given another array book that represents the book, where the index represents a chapter and the corresponding value is the time needed to finish reading that chapter. If you have enough time that evening, you can read more than one chapter, but each time you must read a whole chapter completely (it can't be split up). Under these constraints, return the number of days needed to finish the whole book; if it can't be finished, return the corresponding status / "cannot finish".
Discussion
Loading comments…