Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

baryon's blog

By baryon, 2 years ago, In English

Given (N−2) three-letter substrings, find any string of length N corresponding to the given set of three-letter substrings. If there is no solution print NO Else, print YES in the first line, and the N-characters desired string in the second line.

E.X :

7

xzx, xyx, xyx, zxy, yxz

output : YES, xyxzxyx

E.X:

5

abc, def, xyz

output : NO

constraints: 3<=N<=1e5

Problem Source: https://leetcode.com/discuss/interview-question/2226381/Google-Onsite-2022-Seoul-or-L3

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it