Похожие чаты

How to find whether a string can be converted to

other or not ?
Like 'aab' can be converted to 'bba' so we print yes otherwise no
For eg P='aab' and Q='bba'
In one operation, u can replace all occurences of a single character in P with any character from alphabet Z subject to following simple rules :

1) Replace only happens when new character doesn't already exists in P.
2) Replace operation is atomic to all occurences which means all occurences are replaced simultaneously with same character.
3) All occurences must be replaced.
Alphabet Z consists of lower case english letters only.

1 ответов

9 просмотров

A few hint for you: 1. The core transformation can be modeled as a digraph. What's the meaning of vertices and edges in this problem? 2. In which scenario, the problem can't be build as a digraph (no solution)? 3. What's the property of the digraph? Are there any constraints on the in degree and out degree for the vertices? 4. What if the digraph contains loops? Are there any additional checkings to be done?

Похожие вопросы

Обсуждают сегодня

А чем вам питонисты не угодили?😂
.
79
Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
75
or any website to buy prepaid card with xmr that's not trocador that's down?
Umbrella Party Partner
18
Hi, I can't understand promises in JavaScript and what we should use them for (maybe the teacher didn't teach well XD). Do you have a solution for this? And are promises used...
A
29
Добрый день, LO Writer, проблема с нумерацией таблиц (вставка названия). У меня два стиля нумерованных списка, один для основного текста (вида 1.1.1) другой доя приложений (ви...
Виктор
6
Ещё такой вопрос. Мне необходимо хранить пароль пользователя локально. Для этого планирую использовать ini файл. Это для автозаполнения полей логин и пароль при авторизации. Е...
Евгений
19
всем доброго времени суток! имею вопрос: как понять ТОЧНО, что на нексус производится атака или он перегружен? исходные данные: - Nexus OSS 3.67.1-01 на OrientDB - Total co...
Michael Kostelcev
9
Xem delist ho rha hai agr naa bhechu toh kya hoga after 1 july?
ABHI
27
Ты просто гитлеровскую эстетику плохо понимаешь. Он же всё под Цезаря делал. А это как бы запрещённый приём в политике. Пиджаки они зачем все носят? Чтобы показать что они тип...
Ivan Kropotkin
4
Did you guys see the latest tweet from TonGifts? 🚀
Mike
44
Карта сайта