Back to problems

Ordered Fragment Pairs String-Counting Problem

Algorithm · Capital One · Medium

Determine how many ordered pairs of fragments can be joined to produce the supplied password exactly. Function Examples Input: password: 'sunrise', fragments: ['sun', 'rise', 'sun', 'rise'] Output: 4 Explanation: Each of the two sun fragments can pair with either of the two rise fragments, yielding four ordered pairings. Input: password: 'rainbow', fragments: ['rain', 'bow'] Output: 1 Explanation: Joining rain before bow yields the complete password. Constraints The input…

Checking your access…