Compress the String Ninja has been given a program to do basic string compression. For a character that is consecutively repeated more than once, he needs to replace the consecutive duplicate occurrences with the count of repetitions. Example: If a string has 'x' repeated 5 times, replace this "xxxxx"...
read more
CodingNinjas
author
2y
This was nothing but the Run Length Encoding Algorithm which I was familiar with. So I coded it preety fast.Algorithm :1) Pick the first character from the source string.2) Append the picked character...
see more
CodingNinjas
author
2y
Greedy ApproachHere, we can simply traverse the string and run two loops where the outer loop will hold the unique characters and the inner loop will count the consecutive repetitions of that characte...
see more
Anonymous
5mo
import java.util.LinkedHashMap;
public class Main {
public static void main(String[] args) {
String s="iyyer";
String s1="";
char [] ch=s.toCharArray();
for(char i:ch){
System...
see more
Add answer anonymously...
Top CGI Group Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Top HR questions asked in CGI Group Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app