Тёмный

Best optimal solution to find if strings are anagram using alphabets array. 

Code-Travel-Explore-With-Harshal
Подписаться 5 тыс.
Просмотров 1,4 тыс.
50% 1

Best Optimal solution to identify if two strings are anagram using alphabets array with time complexity O(n)
DSA and Algo Playlist:
• How I Cracked Google ?...

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

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 10   
@snehamalpure1543
@snehamalpure1543 2 года назад
Sir it's very nice explaination , thank you so much for your efforts. please make more such videos so that we will crack Google interview. Thanks 🙏
@CodeTravelExploreWithHarshal
@CodeTravelExploreWithHarshal 2 года назад
Thanks, sure.
@yashgaikwad5559
@yashgaikwad5559 2 года назад
Harshal da .... I m from the same village as of yours ... And currently studying my degree in CSE at Pune ..... Will try my best to get employed at Google and will always be in search of opportunity .... Experience shared by you through your video of how to get placed in Google and what type of format it required also cleared many queries .... Thank you ✌️
@CodeTravelExploreWithHarshal
@CodeTravelExploreWithHarshal 2 года назад
Hey Yash. Thanks for watching.
@madhukarvissapragada8955
@madhukarvissapragada8955 2 года назад
One approach can be taking the sum of ASCII values of both strings and compare the sum. If sum of both strings is equal it's anagram else not an anagram
@CodeTravelExploreWithHarshal
@CodeTravelExploreWithHarshal 2 года назад
Thanks Madhukar for this approach. On high level, below is the logic/code int sum1 = 0; int sum2 = 0; for (char c : string1.toCharArray()) sum1 = sum1 + c; for (char c : string2.toCharArray()) sum2 = sum2 + c; return sum1 == sum2;
@CodeTravelExploreWithHarshal
@CodeTravelExploreWithHarshal 2 года назад
@dush1729 true. This code will fail with ascii sum approach. As sum will be same in many cases although chars are different. Thanks bro
@andrews13
@andrews13 2 года назад
How to know which program will be performance optimal in java, when there can be many ways to write a program?
@CodeTravelExploreWithHarshal
@CodeTravelExploreWithHarshal 2 года назад
Find the complexity of your code. Big-O-Notations.
@mohithnayak8658
@mohithnayak8658 2 года назад
How about comparing character by character with for(char c='a'; c
Далее
If Your Tech Job is Comfortable, You're in Danger
20:57
HackerRank Java - Java Anagrams Solution Explained
11:00
Check if two strings are anagrams
8:50
Просмотров 71 тыс.
Sliding Window Technique - Algorithmic Mental Models
36:45
Data Structures: Anagram Problem Solution
6:41
Просмотров 107 тыс.