This content originally appeared on DEV Community and was authored by Prashant Mishra
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;
}
}
This content originally appeared on DEV Community and was authored by Prashant Mishra
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
Prashant Mishra | Sciencx (2024-10-20T04:13:47+00:00) Find the Sequence of Strings Appeared on the Screen. Retrieved from https://www.scien.cx/2024/10/20/find-the-sequence-of-strings-appeared-on-the-screen/
" » Find the Sequence of Strings Appeared on the Screen." Prashant Mishra | Sciencx - Sunday October 20, 2024, https://www.scien.cx/2024/10/20/find-the-sequence-of-strings-appeared-on-the-screen/
HARVARDPrashant Mishra | Sciencx Sunday October 20, 2024 » Find the Sequence of Strings Appeared on the Screen., viewed ,<https://www.scien.cx/2024/10/20/find-the-sequence-of-strings-appeared-on-the-screen/>
VANCOUVERPrashant Mishra | Sciencx - » Find the Sequence of Strings Appeared on the Screen. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/20/find-the-sequence-of-strings-appeared-on-the-screen/
CHICAGO" » Find the Sequence of Strings Appeared on the Screen." Prashant Mishra | Sciencx - Accessed . https://www.scien.cx/2024/10/20/find-the-sequence-of-strings-appeared-on-the-screen/
IEEE" » Find the Sequence of Strings Appeared on the Screen." Prashant Mishra | Sciencx [Online]. Available: https://www.scien.cx/2024/10/20/find-the-sequence-of-strings-appeared-on-the-screen/. [Accessed: ]
rf:citation » Find the Sequence of Strings Appeared on the Screen | Prashant Mishra | Sciencx | https://www.scien.cx/2024/10/20/find-the-sequence-of-strings-appeared-on-the-screen/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.