AWS Software Engineer vs String Manipulation! | Software Engineering Mock Interviews (

  Рет қаралды 5,259

Interview Pen

Interview Pen

Күн бұрын

Пікірлер: 20
@interviewpen
@interviewpen Жыл бұрын
We'd recommend you play these at 1.5x-2x! Thanks for watching! Visit interviewpen.com/? for more great Data Structures & Algorithms + System Design content 🧎
@oussamabennasr4936
@oussamabennasr4936 3 ай бұрын
Reasoning on the lengthes is easier. Thanks for the good content! [Spoiler alert] I have an attempt in the rest of the comment. def is_additive(input: str, second_number: str = None, target_number: str = None) -> bool: _is_additive: bool = False if target_number: if input.find(str(int(second_number)+int(target_number))) == 0: new_target_number = str(int(second_number)+int(target_number)) _is_additive = _is_additive or is_additive( input[len(new_target_number):], target_number, new_target_number) else: for length_of_first_number in range(1, len(input)): for length_of_second_number in range(1, len(input)-length_of_first_number): first_number = input[0:length_of_first_number] second_number = input[length_of_first_number: length_of_first_number+length_of_second_number] remaining_number = input[length_of_first_number + length_of_second_number:] target_number = str(int(first_number)+int(second_number)) if remaining_number.find(target_number) == 0: _is_additive = _is_additive or is_additive( remaining_number[len(target_number):], second_number, target_number) if len(input) == 0: return True return _is_additive if __name__ == '__main__': input = "347111829" assert is_additive(input) input = "15051101152" assert is_additive(input) input = "000" assert is_additive(input) input = "00000000000000000000000000000000000" assert is_additive(input) input = "000000000001123581321" assert is_additive(input) input = "15141161152" assert not is_additive(input) input = "15051101152254" assert not is_additive(input) input = "12" assert not is_additive(input) input = "123" assert is_additive(input) print("All tests passed!")
@powprashant
@powprashant Жыл бұрын
I wish all real interviews happens like this, in this you you can learn more about candidate not just the coding skills, but also about personality, mindset, being team player, gentleness, listening skills, adaptibility and many other behaviours. Great video 👍
@interviewpen
@interviewpen Жыл бұрын
thanks for the kind words & thanks for watching! more videos coming soon.
@madhuiitb-cse
@madhuiitb-cse Жыл бұрын
I haven't watched at fully!. But, I wanted to comment out. This is gone be a hit like anything. I can say I am going to watch the best mock interview. Thank you @interviewPen
@interviewpen
@interviewpen Жыл бұрын
thanks for the kind words! more coming :)
@ianr2002
@ianr2002 Жыл бұрын
I would have solved this a bit different. The real hurdle was figuring out the starter numbers. What Noah did with the nested fors was good, but he didn't have to use nested fors once those two numbers were found. I would've made a helper function with those nested fors to find the initial two numbers, chuck them into a list, and then use a single recursive function to validate the rest of the string. You know the length and the value of the next string, it's just a matter of cutting it up, validating, appending to the list if it's valid, and moving on to the next part of the string until it's all done. This would give it a complexity lower than O(n^2) in most cases, with a best case of O(n) and worst case of O(n^2)
@f41z37
@f41z37 Жыл бұрын
Love this🔥
@interviewpen
@interviewpen Жыл бұрын
thanks 👍
@aniketpandey2524
@aniketpandey2524 Жыл бұрын
The first thing I noticed after seeing the question is that the first no has some limit to it's length like if we have string of length 8 and we choose first no greater than 4 it's not gonna work as the third no will atleast be 4 digits. After we set the limit on first string range we can brite force I guess to a point.
@interviewpen
@interviewpen Жыл бұрын
Yes good observation, this is what I mentioned where we can prune the choices. (1) pick the first number, (2) pick the 2nd number, (3) validate the rest by the additive rule
@jamesdeng-x1b
@jamesdeng-x1b Жыл бұрын
this is me as a new grad, my thought process all over the place. not gonna lie, since he's experienced, I was expecting more from him. 😂 not in terms of solving the problem, but just the way he's structuring his thoughts, the interviewer basically hand held him all the way lol
@interviewpen
@interviewpen Жыл бұрын
Fair - I actually think he did well considering most engineers who do practical things day-to-day would be caught off-guard in an interview. Many I ask to do these always refrain & say "I'm rusty". We're all rusty - if you do practical work, it is actually under-talked about how normal it is to struggle in an interview if you did 0 pre-prep. And right - Noah just thinks out loud like that, his thoughts are fully-formed, though the words he says seem partial. This is something we discussed after-the-fact with Noah mentioning it. So yeah - brave of Noah to do this & I think we had a good, educational result -> & that's my/our goal in all of this, just to have more of these where you connect concept to reality.
@joaoluismoraes7215
@joaoluismoraes7215 Жыл бұрын
It seems to me this problem is a bit similar to Permutations or something like that. Could we do backtracking here? What would be the optimal approach?
@interviewpen
@interviewpen Жыл бұрын
Yes, in the respect that it is a recursive expression of choice (in permutations we have X possibilities for a slot i, and that changes as we recurse based on previous choices, etc). Yes, the solution in my head was just plain recursion - you express all possible snippets. You can prune the recursion tree when you are in intractable situations, and so on. Optimal, I am not sure. I only know of the brute force with pruned recursion. Are there more solutions? Maybe.
@petertao1887
@petertao1887 Жыл бұрын
what's the pair programming software/website are you folks using in this video?
@experiment0003
@experiment0003 Жыл бұрын
replit
@interviewpen
@interviewpen Жыл бұрын
replit! a unicornnn 🦄 - we might use interviewpen.com in the future since we'll almost always use questions we host, but we don't have multiplayer functionality yet. So yeah, you can use anything, there are a few platforms for multiplayer coding.
@rEbt-ci3bl
@rEbt-ci3bl Жыл бұрын
The result for test 2 was supposed to be true but they got false 38:32
@interviewpen
@interviewpen Жыл бұрын
I think I noticed this but we were running over time so I decided to stop and move onto the reflection portion.
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 220 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 28 МЛН
How Senior Programmers ACTUALLY Write Code
13:37
Thriving Technologist
Рет қаралды 1,6 МЛН
Design a Simple Authentication System | System Design Interview Prep
17:22
a day in the life of an engineer working from home
7:52
Joma Tech
Рет қаралды 21 МЛН
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 645 М.
Most Tech Interview Prep is GARBAGE. (From a Principal Engineer at Amazon)
12:57
Software Engineering Job Interview - Full Mock Interview
1:14:29
freeCodeCamp.org
Рет қаралды 1,5 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 220 МЛН