Find the Sequence of Strings Appeared on the Screen

Prashant Mishra - Oct 20 - - Dev Community
class Solution {
    public List<String> stringSequence(String target) {
        List<String> list  = new ArrayList<>();
        StringBuilder sb = new StringBuilder();
        for(char c : target.toCharArray()){
            if(list.size()!=0){
                sb.append(list.get(list.size()-1));
            }
            sb.append('a');
            list.add(sb.toString());
            for(char i = 'a'+1;i<=c;i++){
                sb.deleteCharAt(sb.length()-1);
                sb.append(i);
                list.add(sb.toString());
            }
            sb.setLength(0);
        }
        return list;
    }
}
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player