Тёмный

String Compression Problem in O(n) time complexity | Java interview question 

Code With Roy
Подписаться 3 тыс.
Просмотров 575
50% 1

Опубликовано:

 

21 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 8   
@ketulpatel1161
@ketulpatel1161 5 месяцев назад
You explained very well... Pasting more simplified code: public static void main(String[] args) { String str = "w4a3d1e1x6"; StringBuilder strBuilder = new StringBuilder(); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (Character.isDigit(c)) { int j = (c - '0'); while (j != 0) { strBuilder.append(str.charAt(i - 1)); j--; } } } System.out.println("Output String: " + strBuilder); }
@satyasai5172
@satyasai5172 3 месяца назад
I need one help in your side
@codeAtoZ
@codeAtoZ 3 месяца назад
Yes sure
@satyasai5172
@satyasai5172 3 месяца назад
I need ur contact number
@dailycodingproblem
@dailycodingproblem 5 месяцев назад
What if the input is w4s6w8a9
@codeAtoZ
@codeAtoZ 5 месяцев назад
@dailycodingproblem it considers each character are unique in string otherwise we can write w4w7w9. Ye will it identify difference. I hope you got it
@dailycodingproblem
@dailycodingproblem 5 месяцев назад
@codeWithDebjeet can you give the link of the question ,also why we are not considering numbers more than 1 digit ex w12s8
Далее
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
I tricked MrBeast into giving me his channel
00:58
Просмотров 4,6 млн
I tricked MrBeast into giving me his channel
00:58
Просмотров 4,6 млн