You and your books
Difficulty: Easy
Acceptance: %
Points: 20.00
You are given n stacks of books, where each stack arr[i] represents the number of books in that stack (with each book having a height of 1 unit). In a single move, you can choose any number of consecutive stacks such that the height of each selected stack is less than or equal to k. After selecting a sequence of stacks, you can collect any number of books from those chosen stacks.
Your task is to determine the maximum number of books you can collect in this manner. You need to complete the function max_Books() which takes the integer arr, n, and k returns the maximum number of books you can collect.
Expected Time Complexity: O(n)
Expected Space Complexity: O(1)