HYLAND ONLINE ASSESSMENT QUESTION

Правка en2, от wronganswer.5, 2023-04-08 09:30:10

You are given a string s. You are allowed to do following operation any number of times: choose two characters in s say c1 and c2, replace all the occurences of c1 with c2 and all the occurences of c2 with c1. You want to make it lexographically smallest.

eg: s="bbcacad" ans: "aabbccd"

step1: choose a and b, we get -> aacbcbd step2: choose b and, we get -> aabcbcd

eg2: s="bdea" ans: "abde"

How to solve this question?

Теги online assessment, string

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский wronganswer.5 2023-04-08 09:30:10 1
en1 Английский wronganswer.5 2023-04-08 08:50:09 471 Initial revision (published)