String Compression | String SB and ArrayLists | In English | Java | Video_3

preview_player
Показать описание

NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Description:
This question will explain you how to compress a string.

Question Name:
String Compression

Question Statement:
1. You are given a string.
2. You have to compress the given string in the following two ways -
First compression The string should be compressed such that consecutive duplicates of characters are replaced with a single character.
For "aaabbccdee", the compressed string will be "abcde".
Second compression The string should be compressed such that consecutive duplicates of characters are replaced with the character and followed by the number of consecutive duplicates.
For "aaabbccdee", the compressed string will be "a3b2c2de2".

Topic: #String #StringCompression

Used #DataStructure: #Strings #StringBuilder #Recursion

#TimeComplexity: O(N)

#SpaceComplexity: O(N) (Recursive Space)

--------------------------------------------------------------

More Youtube PlayList:

---------------------------------------------------------------

Pepcoding has taken the initiative to provide counselling and learning resources to all curious, skillful and dedicated Indian coders. This video is part of the series to impart industry-level web development and programming skills in the community.



We also provide professional courses with live classes and placement opportunities.

.

.

.

Happy Programming !!! Pep it up

----------------------------------------------------------------

#DataStructure #Strings #StringBuilder #Recursion #StringCompression
Рекомендации по теме
Комментарии
Автор

There is another version available for this question.

Sachin_Alam
join shbcf.ru