Round 1
Questions:
Question
-
String Encoding
Encode a given string by collapsing consecutive instances of a single character into two pieces of information: the number of instances and the character. Note that even single characters should be run length encoded. If the string is empty, return an empty string. Your implementation should work on all alphanumeric characters.
Complete thecollpaselnput
function which takes a string input as a parameter and returns the compressed string.
Sample Input
GGGGrrrrrrrrrrrrt
Sample Output
5G14r1t
Explanation
There are 5 'G' characters then there are 14 'r's then there is 1 't'. -
Array Burst problem
Given an input length, string array and burst length(>0) as input, the output should be an array which is a shrunk input array such that the sequentially repeating elements more than or equal to the burst length should be removed. This has to be repeated till the array cannot be shrunk any further. Use single characters in the string Array for simplicity as shown in sample test cases.
Sample case 1:
Input:
8
a
b
c
c
c
d
e
e
3
Output:
a
b
d
e
e
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.