Remove the duplicates from the array without extra space.

Remove the duplicates from the array without extra space.

Here the logic is simple. If we are making the value in an array for the present index as negative. So that if we counter the same value again then we know encountered the negative value and we will know that this is a duplicate number. Study the program for more understanding.

Run Length Encoding

Given a string, Your task is to complete the function encode that returns the run length encoded string for the given string.
eg if the input string is “wwwwaaadexxxxxx”, then the function should return “w4a3d1e1x6″.

Solution of Run Length Encoding

Find largest 3 number from an array

Given an array = {94,5,6,7,33,4,5,77,88,99,100, 96};

Find largest 3 numbers

Ouput:

The first max is 100
The second max is 99
The third max is 96

Code: