Funny I see this since I just subscribed yesterday and had an interview with Amazon 3 days ago. But they asked me 2 string questions. First Question: Given string A and string B, calculate the minimum amount of swaps required to turn A to B. Second Question: Make a class called Dictionary that takes a list of strings as input. Add a function in Dictionary that takes a word and calculates whether it exists in the list of words IFF a word exists that is off by 1 character from the input. So if the input is “hella” and the list of words has “hello” then it would return true.
That's a poorly worded question but fortunately, as you say, the diagram gives you a better idea of what they are on about. Great explanation of how to tackle the solution. As an exercise I swapped the 2nd and the last element in the array to see he difference in the pointer adjustment. Works great.
Thanks for the video! Is it more efficient to first check if the current value is bigger than maxArea and then assign it, or is it better to directly assign it using max() even if the maximum value is the same?
Hello Sir, I have almost 1.5 years of experience in iOS development. Just wanted to know if I try go for an interview now, what are the major topics my interviewer will expect me to know.
Hey, is there a website you’re getting these questions from. I have an interview coming up and I’d like as many practice questions as possible. Thanks!
Pointer is the index of the array. On the code sample, you can just print out the left and right which are the indices of the array from left to right. Then you'll see the pointer changes in each iteration
@@tityseptiani8584 i understand move the point can get the area. But the way how it moves in the example doesn’t cover all the cases. How to verify this way cannot miss the biggest area?
Hey Afraz, Thanks for sharing videos. All of them very helpful. import UIKit let input = [1, 8, 6, 2, 5, 4, 8, 3, 7] func getMaxArea(_ height: [Int]) -> Int { var result = [Int]() if height.count > 1 { for i in 0...(height.count - 2) { for j in (i + 1)...(height.count - 1) { result.append(min(height[i], height[j]) * (j - i)) } } } print("Result: \(result.max()!)") return result.max()! } getMaxArea(input) This's the answer that i can do. Is it nice for interview?
Ive seen this question on multiple interviews. Pretty standard. Probably just worded in different context but the general concept remains the same. My only recommendation is renaming "currentHeight" to "currentArea" since you're recalculating to get the current area and comparing it for it's maximum agains the maximum area. Overall, I really enjoy your videos and excited to watch more . Update: I had trouble understanding the logic of the moving pointers but I finally got it. I appreciate this.
Enjoy my teaching style? Check out iOS Academy+ iosacademy.io/plus
Funny I see this since I just subscribed yesterday and had an interview with Amazon 3 days ago. But they asked me 2 string questions.
First Question: Given string A and string B, calculate the minimum amount of swaps required to turn A to B.
Second Question: Make a class called Dictionary that takes a list of strings as input. Add a function in Dictionary that takes a word and calculates whether it exists in the list of words IFF a word exists that is off by 1 character from the input. So if the input is “hella” and the list of words has “hello” then it would return true.
Can u please share in such interview rounds do we get to use code intelligence?
Haha nice
it'd be great if you could explain the login behind your pointer update code. Why should it work?
That's a poorly worded question but fortunately, as you say, the diagram gives you a better idea of what they are on about. Great explanation of how to tackle the solution.
As an exercise I swapped the 2nd and the last element in the array to see he difference in the pointer adjustment. Works great.
Thank you a bunch for your detailed explanations and clear style, keep it up!
Thanks!
Thanks for the video!
Is it more efficient to first check if the current value is bigger than maxArea and then assign it, or is it better to directly assign it using max() even if the maximum value is the same?
Awesome video, thanks!
Youre welcome
Hello Sir, I have almost 1.5 years of experience in iOS development. Just wanted to know if I try go for an interview now, what are the major topics my interviewer will expect me to know.
hi , what about now? Did you do interview ? Or not
Hey, is there a website you’re getting these questions from. I have an interview coming up and I’d like as many practice questions as possible. Thanks!
Leetcode!
@@iOSAcademy Thank you! Big fan of the videos🙌🏾🙌🏾
First like ❤️ love towards iOS academy
Niceeee
Hi @afraz when will you launch the Interview prep at iOS Academy? Can you add me as a Beta User? Please
It should be currentArea and not currentHeight
Yep, better naming needed for sure
move the pointer part is tricky to understand can you explain more?
Pointer is the index of the array. On the code sample, you can just print out the left and right which are the indices of the array from left to right. Then you'll see the pointer changes in each iteration
@@tityseptiani8584 i understand move the point can get the area. But the way how it moves in the example doesn’t cover all the cases. How to verify this way cannot miss the biggest area?
Hey Afraz,
Thanks for sharing videos. All of them very helpful.
import UIKit
let input = [1, 8, 6, 2, 5, 4, 8, 3, 7]
func getMaxArea(_ height: [Int]) -> Int {
var result = [Int]()
if height.count > 1 {
for i in 0...(height.count - 2) {
for j in (i + 1)...(height.count - 1) {
result.append(min(height[i], height[j]) * (j - i))
}
}
}
print("Result: \(result.max()!)")
return result.max()!
}
getMaxArea(input)
This's the answer that i can do. Is it nice for interview?
Youre welcome & looks good
Ive seen this question on multiple interviews. Pretty standard. Probably just worded in different context but the general concept remains the same.
My only recommendation is renaming "currentHeight" to "currentArea" since you're recalculating to get the current area and comparing it for it's maximum agains the maximum area.
Overall, I really enjoy your videos and excited to watch more .
Update: I had trouble understanding the logic of the moving pointers but I finally got it. I appreciate this.
Great insight
Thought about the renaming as well...