Тёмный
No video :(

HackerRank - Super Reduced Strings | Full solution with visuals and examples | Study Algorithms 

Nikhil Lohia
Подписаться 45 тыс.
Просмотров 8 тыс.
50% 1

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

 

22 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 30   
@thedevguild7525
@thedevguild7525 2 года назад
Wow! I like your explanations! It certainly helps a lot!
@stanislavmozolevskiy8346
@stanislavmozolevskiy8346 Год назад
Good explanation, really simple solutions as well and supper easy to understand. Once you said Stack I pretty much came up with the same solution. :) thank you Nikhil !
@nikoo28
@nikoo28 Год назад
So happy I could help you out.
@fathimasyed4232
@fathimasyed4232 7 месяцев назад
same here i was doing iteration first.
@starScreamScreaming
@starScreamScreaming 3 года назад
this guy speaks with confidence
@marycampbell5264
@marycampbell5264 5 месяцев назад
Eloquent solutions as usual.
@lohithaadapala6989
@lohithaadapala6989 Год назад
The best solution I've seen. Thanks man : )
@nikoo28
@nikoo28 Год назад
You're welcome!
@helsinkired8523
@helsinkired8523 3 года назад
Great video sir. Looking for more.
@nikoo28
@nikoo28 Год назад
You got it!
@tejasbavkar2811
@tejasbavkar2811 2 года назад
Thank you sir...💗
@senthilkumar3000
@senthilkumar3000 Год назад
Good explanation
@beka3304
@beka3304 9 месяцев назад
public static String superReducedString(String s) { Map charCount = new HashMap(); for (char c : s.toCharArray()) { charCount.put(c, charCount.getOrDefault(c, 0) + 1); } Set set = new TreeSet(); for (char c : s.toCharArray()) { if (charCount.get(c) % 2 == 1) { set.add(c); } } return (!set.isEmpty()) ? set.toString() : "Empty String"; }
@lovely_612
@lovely_612 2 года назад
Thank you ❤
@mithraravi9628
@mithraravi9628 2 года назад
Can we use xor operations between characters of the string and get result for this?
@OmKumar-lp1em
@OmKumar-lp1em 7 месяцев назад
def short(s): #s=aaabccddd a=list(s) b=set(s) for i in b: c=s.count(i) if c%2==1: for j in range(c-1): a.remove(i) else: for j in range(c): a.remove(i) d=''.join(a) if len(d)==0: return "empty string" else: return d s="aabbb" print(short(s)) I wrote this but 6 test cases failed
@nikoo28
@nikoo28 7 месяцев назад
have you tried debugging?
@thedevguild7525
@thedevguild7525 2 года назад
Hi Sir, it would be great if you have JS version of the code.
@nikoo28
@nikoo28 2 года назад
I can’t provide the solution in JS but you can check the complete code in the video description…if you understand the logic correctly..writing in JS shouldn’t be a problem.
@nancym8049
@nancym8049 Год назад
Sir Code for final thought
@nikoo28
@nikoo28 Год назад
What code did you come up with? I can help you understand your error. If I give you the solution right away, you wouldn’t learn. That is just the teacher in me speaking 🙂
@nancym8049
@nancym8049 Год назад
@@nikoo28 Great Teacher😄
@shubhammaske3504
@shubhammaske3504 Год назад
But this Approach will not work with this type of string ---> "abbxayzz" !
@nikoo28
@nikoo28 Год назад
what output are you expecting for this particular string?
@nikoo28
@nikoo28 Год назад
for the string "abbxayzz" the output will be -> "axay"...and the code works as expected. Please clarify the doubt you are facing.
@shubhammaske3504
@shubhammaske3504 Год назад
@@nikoo28 Output should be "xy" only.
@nikoo28
@nikoo28 Год назад
abbxayzz -> (remove b) axayzz -> (remove z) axay That’s it…you cannot remove ‘a’ because they are not consecutive
@shubhammaske3504
@shubhammaske3504 Год назад
@@nikoo28 got it, thank you
Далее
Simple Flower Syrup @SpicyMoustache
00:32
Просмотров 667 тыс.
Should you learn C++ in 2023?
8:06
Просмотров 54 тыс.
10 Common Coding Interview Problems - Solved!
2:10:50
Просмотров 573 тыс.
Why do databases store data in B+ trees?
29:43
Просмотров 35 тыс.
Sliding Window Technique - Algorithmic Mental Models
36:45