Could you please help me how to approach this problem? It was asked in faang interview.
Given a string where each character is a sign ('<', '>', '=') and length of the string is N. You need to insert N+1 positive integers such that the sequence is valid.
You are allowed to take positive integers in the range [1, P]. Find the minimum possible value for P.
Examples -
Input: <<<
Output: 4 (the sequence can be 1<2<3<4)
Input: <=>
Output: 2 (the sequence can be 1 < 2 = 2 > 1)