Company: Microsoft_18march
Difficulty: medium
Longest Tile Sequence Problem Description There are N tiles (numbered from 0 to N-1). Each tile is made of two squares that are colored either red (represented by the letter 'R') or green (represented by 'G'). A tile is described by a two-character string representing the respective colors of the left and right squares. The tiles cannot be rotated (which means that "RG" and "GR" tiles are different). Two tiles can be placed next to each other if the color of their adjacent squares is the same. What is the length of the longest possible sequence that can be created using the provided tiles? Write a function: int solution(vector<string> &A); that, given an array A of N strings representing the tiles, returns the maximum number of tiles that can be arranged in a sequence. Examples Example 1: Input: A = ["RR", "GG", "GR", "RG", "RR"] Output: 5 Explanation: we can select tiles 0, 2, 3, 4, 5 (underlined in the picture above) and arrange them into the sequence GR-RR-RG-GR-RR. Exampl