Company: Flipkart_9nov
Difficulty: medium
Longest Necklace Arrangement Problem Description Natalie is a famous jewellery designer, known for her pearl necklace designs. She has a team that helps her create unique designs made of different types of pearls. The team creates individual strings of pearls, and Natalie then arranges the strings in a beautiful way to make a necklace. To begin with, Natalie prepares a rough sketch of the necklace by using a single character code to represent every pearl type she uses. The necklace design is basically arranging a series of strings in a different linear arrangement. The rule is that two pearl strings can be consecutively arranged only if the two strings have a similar suffix chain such that the length of the longest suffix chain of string A that is also the longest prefix chain of string B is LSC(A, B) and LSC(A, B) >= max(|A|, |B|) - 1, where |A| indicates the length of string A. For example, consider String A = [R, G, B, Y] and String B = [Y, G, B, P] . The longest suffix of A that is