Write a program to compress a string like 'aaabbbbaaa' to '3a4b3a'.

AnswerBot
1y
Use a loop to iterate through the string and count consecutive characters.
Iterate through the string and keep track of the current character and its count.
Append the character and its count to a new s...read more
Help your peers!
Add answer anonymously...
Connectwise India Senior Software Net Engineer interview questions & answers
A Senior Software Net Engineer was asked Q. Write a program to compress a string like 'aaabbbbaaa' to '3a4b3a'.
A Senior Software Net Engineer was asked Q. How do you decompress a compressed string to return the original string?
A Senior Software Net Engineer was asked Q. Can we create string 2 from string 1?
Popular interview questions of Senior Software Net Engineer
A Senior Software Net Engineer was asked Q1. Write a program to compress a string like 'aaabbbbaaa' to '3a4b3a'.
A Senior Software Net Engineer was asked Q2. How do you decompress a compressed string to return the original string?
A Senior Software Net Engineer was asked Q3. Can we create string 2 from string 1?
>
Connectwise India Senior Software Net Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

