Intuit | SDE-2 | Onsite

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2021-08-09Added By Anonymous
Source: Link

Hi Folks,

I got this question during onsite interview with Intuit. Any help to solve/approach is highly appreciated.


Problem Statement:

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]. k.


Examples -

Input: <<<

Output: 4 (the sequence can be 1 < 2 < 3 < 4)


Input: <=>

Output: 2 (the sequence can be 1 < 2 = 2 > 1)


Input: >><>

Output: 3 (the sequence can be 3 > 2 > 1 < 2 > 1)


Input : <>><<<>>=<<<<>

Output:

Comments