Company: BNY Codedivas 2026
Difficulty: medium
The Library Problem Sam has been appointed as the new Librarian in a library. He needs to perform the following operations on the N books arranged in the bookshelves to get a unique combination of books: He must select a K -length contiguous sequence of books from the bookshelf. He must then remove the books that were chosen. Then he needs to merges the remaining books and determine whether the resulting sequence is unique. He has to repeat this operation for all possible contiguous segments of books from the N books on the bookshelf. Given an array A which represents the N books in the bookshelves, your task is to help Sam find and return an integer value representing all the possible unique combinations of books that can be generated. Note: The books can be represented by unique integers ranging from 1 to 20. Contiguous elements are consecutive elements. Input Specification: input1 : An integer value N, representing the total number of books on the shelf input2 : An integer value K,