In a recent competition organized by “AmDocs” , I came across the following question : (The basic Idea of the question)
You are a given a matrix of fixed size 12x12.
You are given six line segments of length 6,5,5,4,3,2.
The matrix has empty spaces and filled spaces.
You have to return “Yes” Or “No” , whether all the 6 line segments can be fit into the matrix or not.
The lines can be placed horizontally or vertically.
What algorithm should be used to solve this problem ? Packing ? Knapsack ?