1061 Lexicographically Smallest Equivalent String - Leetcode January Challenge 2023

preview_player
Показать описание
I had fun solving this question, this question involves union-find. We can group characters and make group leaders lexicographically ranked least. Then from that array, we will find lexicographically the smallest of baseStr.
TC: O(n) & SC: O(1)

The time complexity of the findParent function is less than 4
Do let me know if you need an explanation of the union-find algorithm in detail.

TAGS:
#layoffs
#layoff
#leetcode
#leetcodesolution
#leetcodedailychallenge
#graphs
#dfs
#bfs
#java
#cpp
#2023
#january
#motivation
#1061

Youtube Search Terms Suggested by Youtube:
leetcode daily challenge
Рекомендации по теме
visit shbcf.ru