Repeated DNA Sequences

  Рет қаралды 22,106

Kevin Naughton Jr.

Kevin Naughton Jr.

Күн бұрын

Пікірлер: 61
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
If anyone has questions/wants help HMU on instagram or twitter instagram.com/kevinnaughtonjr/ twitter.com/KevinNaughtonJr
@nixonatlas1371
@nixonatlas1371 3 жыл бұрын
I dont mean to be so off topic but does anyone know a method to log back into an instagram account..? I was stupid lost my account password. I love any help you can offer me!
@jreneew2
@jreneew2 5 жыл бұрын
With your help I've been getting past phone interviews! Thanks
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
That's awesome Drew super happy to hear that good stuff!!!!
@codeblooded6760
@codeblooded6760 4 жыл бұрын
i++ + 10 😳 this guy is dangerous
@anupampoddar7824
@anupampoddar7824 5 жыл бұрын
you have been a constant support and motivation.thankyou sir for everything!
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
Anytime!!!
@RagazzoKZ
@RagazzoKZ 5 жыл бұрын
Thanks! It's an easy problem. But what about to find a 100% beating solution?
@anonymy834
@anonymy834 Жыл бұрын
can anyone tell me in example one, why "aaaacccca", "aaacccccaa|","aacccccaaa",etc not in the output? they also appeared more than once in the string
@sahilbhagat5024
@sahilbhagat5024 11 ай бұрын
same doubt
@RagazzoKZ
@RagazzoKZ 5 жыл бұрын
Well, you can use just two sets instead of using a hash map. Here is a javascript example: if (s.length
@stephan24297
@stephan24297 4 жыл бұрын
In a lot languages, it's not simple to convert a set into an array. That method also requires creating more variables leading more room for error as opposed to just a simple check if it's equal to two.
@saravanansarangan7035
@saravanansarangan7035 5 жыл бұрын
Thanks Kevin great explanation
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
Anytime Saravanan thanks for your support!
@alexpetrash8414
@alexpetrash8414 4 жыл бұрын
I think you are wrong with memory usage calculation, as soon as length of substring is 10 and only 4 different chars can be used, we can calculate the amount of all possible substrings, it will be 4^10 = 1048576, it is a quite big number but it is not depends on length of input string
@rohandhekne1561
@rohandhekne1561 5 жыл бұрын
do a video on "minimum window substring". plz
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
Rohan Dhekne I'll add it to my list!
@ankitbug
@ankitbug 3 жыл бұрын
We can use set too.
@ersinerdem7285
@ersinerdem7285 3 жыл бұрын
expected rolling hash solution from you actually
@aj9706
@aj9706 5 жыл бұрын
Nice video.could u pls solve partition to k equal subset sum problem?
@aj9706
@aj9706 5 жыл бұрын
@Kevin could u solve Longest increasing subsequence and more BFS questions.
@CodingWithPrakash_
@CodingWithPrakash_ 4 жыл бұрын
kzbin.info/www/bejne/Y4bIepqLpqZ5mK8
@algorithmimplementer415
@algorithmimplementer415 5 жыл бұрын
Nice video. One question : For every character in the string, you are calling substring which is of time complexity O(n). Here n = 10, Does not it make it O((m - n) n) overall, where m = no of characters in the string?
@algorithmimplementer415
@algorithmimplementer415 5 жыл бұрын
In my humble opinion, it would be great if you explain time complexity in generic version, not too specific to this problem, when 10 character substring is specified. Because I have seen that interviewers get happy if you explain time complexity with no assumption (which is here n = 10). :)
@crustysoda
@crustysoda 5 жыл бұрын
you can enqueue a character and dequeue when exceed m character instead of substring. enqueue and dequeue is O(1) so overall time complexity is still O(n). In java, string is immutable so it is a bit janky and you might need StringBuilder to work instead of normal string and queue array.
@ajr1791ze
@ajr1791ze 5 жыл бұрын
Which platform is best to practice for google interviews ?
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
I def think LeetCode is best
@ajr1791ze
@ajr1791ze 5 жыл бұрын
@@KevinNaughtonJr Thanks I am currently using it to solve problems at least 3 / day.
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
@@ajr1791ze Anytime and that's great keep it up!
@ajr1791ze
@ajr1791ze 5 жыл бұрын
@@KevinNaughtonJr Yup! Thanks.
@thecheekychinaman6713
@thecheekychinaman6713 4 жыл бұрын
This feels like it should be classified as an Easy question (as I was able to solve it lol)
@KevinNaughtonJr
@KevinNaughtonJr 4 жыл бұрын
Haha give yourself more credit!!!
@TheTessatje123
@TheTessatje123 5 жыл бұрын
Thanks! I was misunderstanding the task: I thought the subsequences may not overlap (eg. "AAAAAAAAAAA" 11 chars).
@tubedaputtar
@tubedaputtar 4 жыл бұрын
Can we use KMP Algorithm to find if subsequence is present in case interviewer asks for O(1) space solution?
@cnaught0802
@cnaught0802 5 жыл бұрын
Not an engineer, but love your vids. Keep it up!
@dviyakrishnamoorthi5394
@dviyakrishnamoorthi5394 4 жыл бұрын
what?
@ninja-gh
@ninja-gh 4 жыл бұрын
The same question was asked in an interview for me :(
@vaibhavshukla444
@vaibhavshukla444 4 жыл бұрын
Which company bro
@ninja-gh
@ninja-gh 4 жыл бұрын
@@vaibhavshukla444 One of the startup company in HYD location.
@mostinho7
@mostinho7 4 жыл бұрын
Done thanks Todo:- take notes in onenote Asking us to detect repeated substrings of length n Generate substrings of length n from original string, putting each substring generated in a hashmap, with the substring as key and value is how many times we encountered that substring. At the end return the map entries with value more than 1 O(n) because we loop through the entire original string
@algorithmimplementer415
@algorithmimplementer415 5 жыл бұрын
@Kevin Naughton Jr. Beautiful code!
@Gint-j9j
@Gint-j9j 5 жыл бұрын
Hey man, do the interviewers ask you to solve the problem in a specific language or can I solve the problem in any language I want. I'm good at Python and know only basics of Java. So if they asked me to solve the problem in any other language except for python, I'm pretty much screwed.
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
Generally speaking you're normally able to use just about whatever language you want. Some companies prefer that you stick to things like Java, Python, C, etc but it's pretty much always not a problem
@yasvidobariya1247
@yasvidobariya1247 4 жыл бұрын
Is it accepted solution,it can't beat more than 90 percent people.
@justinf7438
@justinf7438 5 жыл бұрын
Great video!
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
Justin F thanks Jus!!!
@varunnarayanan8720
@varunnarayanan8720 4 жыл бұрын
Nice Thanks
@rafailbaldal6062
@rafailbaldal6062 4 жыл бұрын
there are much better solutions out there using custom hashes , this is a very naive solution
@sadafalam2903
@sadafalam2903 2 жыл бұрын
I hate that I doubt myself. I knew when he wrote the code, that the getOrDefault function would take "subsequences" instead of "seen" but of course I went against my intuition. #impostersyndrome
@karthikrangaraju9421
@karthikrangaraju9421 4 жыл бұрын
Hey @Kevin, nice solution, whenever the solution is so easy there is definitely some crazy fancy solution that is much more efficient :P I ran into Rabin-Karp: kzbin.info/www/bejne/p4Kbp4Zol9mmrqs I think we need to apply it here and we wouldn't have to build a substring for every sliding window. What do you think?
@tushargoyaliit
@tushargoyaliit 5 жыл бұрын
Please focus on algorithm more as many of your viewers code in C++
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
The logic should be the same regardless of the language!
@tushargoyaliit
@tushargoyaliit 5 жыл бұрын
@@KevinNaughtonJr yup oviously. so spend more time in logic and dont tell specifi of java that we will use that to do that. Discuss taking into account all language coders and at end might code in java. Your videos are just awesome
@KevinNaughtonJr
@KevinNaughtonJr 5 жыл бұрын
Dream Builder thanks!!!
@joey7409
@joey7409 5 жыл бұрын
He literally says the logic before he writes each line
@jak0495
@jak0495 5 жыл бұрын
@@joey7409 Everything he says is so illogical
@SANJAYMUNDHRAindia
@SANJAYMUNDHRAindia 4 ай бұрын
The below code runs out of time on 30th test case. Can someone help me optimize it? It is in php. class Solution { /** * @param String $s * @return String[] */ function findRepeatedDnaSequences($s) { $output = []; $i=0;$j=0;$k=10; $substr = ''; $result = []; while($j
Reorganize String
12:44
Kevin Naughton Jr.
Рет қаралды 78 М.
An Entire Computer Science Degree in 11 Minutes
11:13
Kevin Naughton Jr.
Рет қаралды 870 М.
Маусымашар-2023 / Гала-концерт / АТУ қоштасу
1:27:35
Jaidarman OFFICIAL / JCI
Рет қаралды 390 М.
one year of studying (it was a mistake)
12:51
Jeffrey Codes
Рет қаралды 167 М.
Unique Paths
7:07
Kevin Naughton Jr.
Рет қаралды 60 М.
Repeated DNA Sequences - Leetcode 187 - Python
7:31
NeetCode
Рет қаралды 35 М.
Repetitive and non repetitive DNA sequences
20:46
Manasa Y
Рет қаралды 15 М.
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 374 М.
Minimum Domino Rotations for Equal Row
12:34
Kevin Naughton Jr.
Рет қаралды 43 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 730 М.
The HARSH Reality of Working in Big Tech
8:42
Kevin Naughton Jr.
Рет қаралды 23 М.
How to Get Ahead of 99% of Software Engineers
8:22
Kevin Naughton Jr.
Рет қаралды 11 М.
Coin Change
10:16
Kevin Naughton Jr.
Рет қаралды 154 М.
Маусымашар-2023 / Гала-концерт / АТУ қоштасу
1:27:35
Jaidarman OFFICIAL / JCI
Рет қаралды 390 М.