Panda Guru LogoPanda
Guru

Valid FW Patterns

Round 1

Questions: You are given an array nums where each element represents the required count of consecutive F characters. You are also given a string s containing characters F, W, and ?. Each ? can be replaced by either F or W. The task is to determine how many valid FW patterns can be formed, where the conditions are:

Example 1: Input:

nums = [1, 2] s = "?W??FW"

Output:

1

Explanation: The only valid pattern is FWWFFW. Other patterns, such as WWFFFW, do not satisfy the condition of exactly 1 and 2 consecutive Fs.

Example 2: Input:

nums = [1, 1] s = "?WW??"

Output:

2

Explanation: The valid patterns are FWWFW and FWWWF.

Example 3: Input:

nums = [1, 1] s = "WW??W"

Output:

0

Explanation: No valid pattern can be formed because the required two separate groups of 1 F cannot be satisfied.

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.