@mujtabarehman5255 it's true though, yandex is the Russian Google and if your run ads on their platform and you also have a physical ad for example a billboard, with yandex you can target people who saw your billboard. That's because yandex tracks exact GPS location and knows the angle at which people crossed your billboard. Also if you use yandex metrica, which is the equivalent of Google analytics, you can see exactly where people clicked or scrolled on your website
Only difference I had was using a map instead of just a basic array for the frequency graphs. If I had to guess, the array is probably better in both compute time and memory compared to a map with it's overhead, but it only works assuming the strings only contain the 26 English lowercase alphabet characters. Here would be my Java submission: private static final BiFunction ADD = (a, b) -> { int s = a + b; return s == 0 ? null : s; }; private static boolean perm(String s1, String s2) { HashMap f1 = new HashMap(), f2 = new HashMap(); for (char c : s1.toCharArray()) { f1.merge(c, 1, ADD); } char[] s2a = s2.toCharArray(); int l1 = s1.length(), l2 = s2a.length, n = l1; for (byte i = 0; i < l1; ++i) { f2.merge(s2a[i], 1, ADD); } do { if (f1.equals(f2)) { return true; } f2.merge(s2a[n - l1], -1, ADD); f2.merge(s2a[n], 1, ADD); } while (++n < l2); return false; }
Well it's the instant lookup for the value. To search any value is O(1). If you search a list your worst time search could be O(N). Also code wise it's going to be a little more messy to update the list cause you're going to need a list of list and access the 2nd index. I think due to the fact there's only 26 letters in the alphabet that a list of list isn't a bad approach since your N is just 26.
Can't u just do something like this: 1. If s1 is longer then s2 return false 2. For each char x in s1 -> if s2 contains x -> -> remove x from s2 -> else return false Return true
@@GregHogg hey the one where you check out the island in a matrix count the number of transitions from 0 to 1 row wise and column wise then multiply by 2
Master Data Structures & Algorithms For FREE at AlgoMap.io!
Yandex have a pretty good reverse image search
Also pretty good spyware
@@dimitarivanov7249 "everything that comes from Russia is spyware" - some you would expect to read on leddit, not in a programming video.
@@dimitarivanov7249Nice conspiracy theory
@mujtabarehman5255 it's true though, yandex is the Russian Google and if your run ads on their platform and you also have a physical ad for example a billboard, with yandex you can target people who saw your billboard.
That's because yandex tracks exact GPS location and knows the angle at which people crossed your billboard.
Also if you use yandex metrica, which is the equivalent of Google analytics, you can see exactly where people clicked or scrolled on your website
@@dimitarivanov7249 Yandex devs spying my 25th Kamen Rider reverse image search this week
It is a russian company. Basically, russian Google
love your content it's fantastic and full of valuable lessons
Damn! Thanks man great content
Only difference I had was using a map instead of just a basic array for the frequency graphs. If I had to guess, the array is probably better in both compute time and memory compared to a map with it's overhead, but it only works assuming the strings only contain the 26 English lowercase alphabet characters. Here would be my Java submission:
private static final BiFunction ADD = (a, b) -> {
int s = a + b;
return s == 0 ? null : s;
};
private static boolean perm(String s1, String s2) {
HashMap f1 = new HashMap(), f2 = new HashMap();
for (char c : s1.toCharArray()) {
f1.merge(c, 1, ADD);
}
char[] s2a = s2.toCharArray();
int l1 = s1.length(), l2 = s2a.length, n = l1;
for (byte i = 0; i < l1; ++i) {
f2.merge(s2a[i], 1, ADD);
}
do {
if (f1.equals(f2)) {
return true;
}
f2.merge(s2a[n - l1], -1, ADD);
f2.merge(s2a[n], 1, ADD);
} while (++n < l2);
return false;
}
He is so close to becoming an alien
and nobody said it cannot contain capital letters, numbers, chars in that string not forgetting some countriers wierd characters basically unicode ...
lol have you heard of Yandex? ?? That’s gold.
I’ll say that no one should know them
how do u find these questions?
Isn’t "d", "c" and "" also permutations of "dc"?
Might be confusing with subsets or substrings
"...well neither have I" xD!
t & s interchanged in code
how efficient is it to use list instead of hashmap in this case? ive heard that using map is better when it comes to alphabets but I dont get why
Well it's the instant lookup for the value. To search any value is O(1). If you search a list your worst time search could be O(N). Also code wise it's going to be a little more messy to update the list cause you're going to need a list of list and access the 2nd index.
I think due to the fact there's only 26 letters in the alphabet that a list of list isn't a bad approach since your N is just 26.
Can't u just do something like this:
1. If s1 is longer then s2 return false
2. For each char x in s1
-> if s2 contains x
-> -> remove x from s2
-> else return false
Return true
I guess mine is O(n^2) where urs is closer to O(n) (in time complexity)
Yandex is like Google but in Russia
yes i am. i live in Russia.
Haha yep, then you certainly would!
I just had this question and failed
Awe :(
Lol everyone knows Yandex
are you living in cave?
Yandex the rusian Google
Yep hahaha
@@GregHogg hey the one where you check out the island in a matrix count the number of transitions from 0 to 1 row wise and column wise then multiply by 2
How to get dark theme of leet code