you all prolly dont give a shit but does any of you know of a trick to get back into an Instagram account?? I somehow lost the account password. I appreciate any assistance you can give me!
I did this using 2 for loops. I created an extra array with the size of the string. Then iterated through the array, if it was a vowel, add it to the array at the index it was at. Then go through the string again and grab the last element of the vowel array and added it to the string. I also used string builder to make sure I wasn't creating a new string every time
Hi Kevin, I am very grateful for the short but extremely well-explained videos. Please do not stop since you are helping a lot of people getting better lives. I have a request. Could you please solve Last Stone Weight II (Problem 981) on Leetcode?
Thanks Pavan and don't worry I won't the whole purpose of my channel is to help people so I'm super happy to hear it's doing that! I'll make sure to put that problem on my list :)
Kevin, thank you for awesome videos. I've been following your videos for a while. I will have a phone screen interview with Amazon for a DE position next week. I'd like to connect and get some advice from you.
Why not just use a for loop where i is your starting index, and keep decrementing j until i and j meet while performing the same swapping of vowels? Seems like it would be more readable and prevent you from making mistakes where you'd be stuck in an infinite loop.
Although you have nested loops here, if you think about the condition of the inner loop it doesn't actually go through the string more than a string for length 'n' because it will stop if it reaches the end of the string.
A much cleaner approach could be using a stack. Linear time, linear space complexity private String main(String s) { String str= ""; String vowels= "aeiouAEIOU"; Stack stack = new Stack(); for(int i=0;i
Not sure if you’d know, but do you know what should be expected of a Goldman Sachs on-site interview? Also great videos, you’ve got really great explanations
Well, I think interviewer want you to swap this way. But as we definately have to make new string in java I collected all the vowels in stack and the second time popped them without swapping. It's slower but much simpler. I'll try to modify a little you approach to get a better result. Upd. my approach didn't work
Hi Kevin, Good one ! One condition what if no vowels in string, we not covering, i guess if we use continue inside the two inner while loop, it will cover no vowels as well.
@@KevinNaughtonJr it worked :) but the test cases where more speciefic than I expected them to be. Well I guess it's time I start learning when to implement this approach for optimal solutions. PS: thanks for the the videos solution.
Hey You make awesome content but can you make a video dedicated on How to use collection framework and all its method I am new to java and its very confusing please. Thanks in advance
Noob questions I just wrote thing same but put i++ and j++ in while loop where you put them in braces and it didn't work I don't know why so. Here is the link to my solution pastebin.com/mNQjicbw
3:06
Since java 9, we can create an immutable collection using the following
Set vowels = Set.of('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U');
You have a natural way of explaining things. Nicely done!
I NEVER comment, but you deserve more subscribers. Thank you!
you all prolly dont give a shit but does any of you know of a trick to get back into an Instagram account??
I somehow lost the account password. I appreciate any assistance you can give me!
You can just create the vowels as lowercase and when checking, check current char in set as lowercase
I did this using 2 for loops. I created an extra array with the size of the string. Then iterated through the array, if it was a vowel, add it to the array at the index it was at. Then go through the string again and grab the last element of the vowel array and added it to the string. I also used string builder to make sure I wasn't creating a new string every time
same
Hi Kevin, I am very grateful for the short but extremely well-explained videos. Please do not stop since you are helping a lot of people getting better lives. I have a request. Could you please solve Last Stone Weight II (Problem 981) on Leetcode?
Thanks Pavan and don't worry I won't the whole purpose of my channel is to help people so I'm super happy to hear it's doing that! I'll make sure to put that problem on my list :)
We don't need to swap the chars when i == j, that's an improvement
Please do more videos on backtracking with explanation on time complexity. I think many of us don’t get it right.
It’s crazy thinking that if you don’t have any vowels you will be swapping one for the same. That’s so clever, i would’ve done this more complicated.
I love your videos man. Your explanations for every problem are easy to understand. Thanks for always putting out more content!
Thanks Kevin, really helpful..good to see explaining time complexities in the videos.
Thanks!
Great explanation
Thanks Royston!
Kevin, thank you for awesome videos. I've been following your videos for a while. I will have a phone screen interview with Amazon for a DE position next week. I'd like to connect and get some advice from you.
Thanks for posting. Nice explanation!
Thank you !
Could you go over the Game of Life problem? Thanks, I love your videos!
Why not just use a for loop where i is your starting index, and keep decrementing j until i and j meet while performing the same swapping of vowels? Seems like it would be more readable and prevent you from making mistakes where you'd be stuck in an infinite loop.
Can anyone explain to me how is the time complexity O(n) in this solution , because we have nested loops?
Although you have nested loops here, if you think about the condition of the inner loop it doesn't actually go through the string more than a string for length 'n' because it will stop if it reaches the end of the string.
These videos are really helpful!
Thanks a lot, this was great!
500th LIKE ! Good job brotha !
A much cleaner approach could be using a stack.
Linear time, linear space complexity
private String main(String s) {
String str= "";
String vowels= "aeiouAEIOU";
Stack stack = new Stack();
for(int i=0;i
Not sure if you’d know, but do you know what should be expected of a Goldman Sachs on-site interview?
Also great videos, you’ve got really great explanations
Well, I think interviewer want you to swap this way. But as we definately have to make new string in java I collected all the vowels in stack and the second time popped them without swapping. It's slower but much simpler. I'll try to modify a little you approach to get a better result. Upd. my approach didn't work
Hi Kevin,
Good one !
One condition what if no vowels in string, we not covering, i guess if we use continue inside the two inner while loop, it will cover no vowels as well.
Only last character will be swapped by itself and loop will terminate. Everything is fine.
Great solution. I would add small correction HashSet vowels = new HashSet(); instead of Set vowels = new HashSet(); (line 3)
thanks kev!
Why not use regex.pattern for vowels??
Can you do tuts on gsoc kevin???
how u knw it was ask in amazon
you are loosing weight !!!
Vowels are 'a', 'e', 'i' , 'o' , 'u'.
Why is j=s.length()-1 and not just s.length()
nevermind, I got it
would it work if I used if statements for the test cases instead of the while (inner ones)
give it a try :)
@@KevinNaughtonJr it worked :) but the test cases where more speciefic than I expected them to be. Well I guess it's time I start learning when to implement this approach for optimal solutions.
PS: thanks for the the videos solution.
Amir LS591 anytime!
Hey You make awesome content but can you make a video dedicated on How to use collection framework and all its method I am new to java and its very confusing please. Thanks in advance
Hi Kevin, Can you make a video of "leetcode.com/problems/reconstruct-itinerary/"? Thanks in advance.
TLE
Noob questions I just wrote thing same but put i++ and j++ in while loop where you put them in braces and it didn't work I don't know why so.
Here is the link to my solution pastebin.com/mNQjicbw
Yours rate of posting videoss per day was very less ...i was disgusted..
he's been slacking i'm disgusted as well.
Ummm Disgusted? I think the word you are looking for is "Disappointed".
hahaha