LeetCode Question · Feb 2024 · Washington DC

SnapChat Tech Screen Feb 2024

3 upvotes 761 views 4 replies

Question Details

Connect Pairs (from hacker rank)

Input : [Ba, _a, cb, dc]

output : _abcd Input : [El, ll, lo, _h, he]

output : hello condition : the resultant string should begin with In...

Full Details

Connect Pairs (from hacker rank)

Input : [Ba, _a, cb, dc]

output : _abcd

Input : [El, ll, lo, _h, he]

output : _hello

condition : the resultant string should begin with _

In this question, one had to connect the pairs. In this [Ba, _a, cb, dc] one example of pair is ba, _a, cb & dc.

Have to place pairs in a way such that second character in each pair is same as first character in next pair. Like :
[Ba, _a, cb, dc] to[_a, ab, bc, cd]

Finally, remove all the redudant adjacent character : From [_a, ab, bc, cd] to _abcd

Can anyone help paste a similar question on leetcode ? Unable to find one.

About This Question

This is a reported interview question from a snap interview for a swe role reported in 2024.

It covers the following topics: Strings .

Topics