VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
Python Algorithms for Interviews

Python Algorithms for Interviews

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Learn about common algorithm concepts in Python and how to solve algorithm challenges you may encounter in an interview. --Contents Ibby: Great content. Quick question, though: For the array common elements, why not change one array into a set and then check if each element of the other array is in that set and append to the output list if they are? Is this not optimal?
Also, in the non-repeating elements in array problem, when iterating over the sorted items of the dictionary, comparing the letter frequency to the lowest frequency in the dictionary doesn't guarantee uniqueness. If you change the input string to -I Apple is Ape Peels- you'd get back [ i, a, l, s] since they have the lowest frequencies of 2. The code should be changed to -if item[1] == 1:- to guarantee the letter is unique/only shows up once in the string.

Date: 2022-03-14

Comments and reviews: 9


The fact that you're here to learn algorithms for interviews just shows how dumb these interview questions are. People who ask you these questions in interviews have no idea how to actually interview people. If you get asked these questions in an interview, and you care about finding a good place to work, look elsewhere. Asking -gotcha questions- in interviews is a sure sign you would be working with people who are just going through the motions with no real appreciation for solving actual problems and doing good work.
reply

It's difficult to follow when you first write code and only later explain what you're doing. It's also exactly what you should not do in an interview. You should come up with a purely verbal explanation, perhapse do some sketch of it - well before you write a single line of code. What makes it easier for an inteviewer understand what you want to do, also makes it easier for your own viewers here (and it's also what'd be expected in a real inteview, so ideally you should demonstrate that).
reply

In last algorithm to get non_repeating elements in array, the last if statement which compares each element in sorted y with y[0][1] is not a good idea, string with no unique chars will break this part and will return list with elements which are repeated min time instead of empty list, so it is better to compare to one, like if item[i] == 1
reply

Question about the Array Algo starting at 01:06:33, this method will only work for array that contains perfect pairs, won't work for arrays like [1,5,2,2,3,3,4] and k = 6, there's an additional 2 that doesn't have another number to make up a pair. How do we deal with this type of input arrays? Thank you!
reply

For finding Array Common Elements, in first if statement when we find common element we need to increase p1 and p2 by one. Because for input like: a = [1,2,3,8,9], b = [2,4,7,8,9] we get not correct answer if we move p2 to two position forward.
reply

For the Reverse a String problem, why does the function return --.join(reversed(s))? Using reversed() on the original input string can directly output 'tseb eht si sihT', the algorithm inside the defined function was not used at all right?
reply

For largest sum, why are you taking max(current_sum + item, current_sum) instead of just current_sum + item ? I am getting the same answer and I'm confused. Wouldn't -current_sum + item- always be larger than item?
reply

In your compare element method p2 should increment by 1 not 2 if a[p1] and b[p2] are equal otherwise if the first two values are equal it will miss the second
reply

Wow I actually get Big O notation now after all this time. Thank you for this series and I am gonna be putting timestamps for myself here
Day 1 - 43:04

reply
Add a review, comment






Other channel videos