Codechef - Petersen Graph - Walk Path Existence - Checked Using BFS - Java Code Explained

preview_player
Показать описание
Codechef - Petersen Graph - Walk Path Existence - Checked Using BFS - Java Code Explained.

If you find this video helpful, please 'Like' & 'Subscribe'.
This is really helpful for the channel and also motivates me to do more of such good videos.

Problem Description:
The following graph G is called a Petersen graph and its vertices have been numbered from 0 to 9. Some letters have also been assigned to vertices of G, as can be seen from the following picture:

Let's consider a walk W in graph G, which consists of L vertices . A string S of L letters 'A'-'E' is realized by walk W if the sequence of letters written along W is equal to S. Vertices can be visited multiple times while walking along W.

For example, S = 'ABBECCD' is realized by W = 0, 1, 6, 9, 7, 2, 3

Your task is to determine whether there is a walk W which realizes a given string S in graph G, and if so, find the lexicographically least such walk.

#coding #softwareengineer #Leetcode #Algorithm #DataStructure #Java #programmer #tech #software #codinglife #Preparation
#interview #programminglife #programmingisfun #codeforces #codechef
Рекомендации по теме
visit shbcf.ru