Menu
Question Index
...


Write a program to find out the order of stroke out letters by counting 1, 2, 3 etc. As shown for SACHIN below, A is first cancelled out since it is 2nd (1 + 1) letter from begining, followed by I which is the 3rd letter (2 + 1) from A, followed by H which is the fourth letter (3 + 1) from A and so on. Please note that the last letter remaining should not be included in the output.

Input (Character array) Output (Character array)
['S', 'A', 'C', 'H', 'I', 'N'] S*CHIN -> A
S*CH*N -> I
S*C**N -> H
**C**N -> S
**C*** -> N
Output = ['A', 'I', 'H', 'S', 'N']
['G', 'A', 'N', 'G', 'U', 'L', 'Y'] ['A', 'U', 'N', 'G', 'G', 'L']
['L', 'A', 'X', 'M', 'A', 'N'] ['A', 'A', 'M', 'L', 'N']
['D', 'R', 'A', 'V', 'I', 'D'] ['R', 'I', 'V', 'D', 'D']

class FindStrokeOutLettersOrder

{    public static void main(String s[])
    {
        char input[] = {'Y', 'U', 'V', 'R', 'A', 'J'};
        System.out.print("The strike out order is : ");
        for (char ch : getStrikeOutOrder(input)) {
        System.out.print(ch + " ");
        }

    }


public static char[] getStrikeOutOrder(char[] input) {
//Write a code here to get the order of the stroke out letters.
}
}

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App