Spread the word.

Share the link on social media.

Share
  • Facebook
Have an account? Sign In Now

Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Browse

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the question so it can be answered easily.

Please choose the appropriate section so the question can be searched easily.

Please choose suitable Keywords Ex: question, poll.

Browse
Type the description thoroughly and in details.

Choose from here the video type.

Put Video ID here: https://www.youtube.com/watch?v=sdUUx5FdySs Ex: "sdUUx5FdySs".

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

MeroLearning

MeroLearning Logo MeroLearning Logo

MeroLearning Navigation

  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • New Questions
  • Trending Questions
  • Must read Questions
  • Hot Questions
Home/ Questions/Q 3743
In Process
samyakchy
  • 0
samyakchyEnlightened
Asked: August 1, 20222022-08-01T06:37:22+00:00 2022-08-01T06:37:22+00:00

Solving Coding Interview Questions in Python on LeetCode (easy & medium problems) Merolearning.com

  • 0
Solving Coding Interview Questions in Python on LeetCode (easy & medium problems) Merolearning.com

In this video we walk through a series of eight coding interview questions on leetcode. These are algorithms problems that cover topics including data structures, time & space complexity, sorting, binary search, object oriented programming, breadth first search, tree traversals, and more. The difficulty of problems range from easy to medium and get gradually harder as you go through the video.

Practice your Python Pandas data science skills with problems on StrataScratch!
https://stratascratch.com/?via=keith />
Join the Python Army to get access to perks!
YouTube – https://www.youtube.com/channel/UCq6XkhO5SZ66N04IcPbqNcw/join
Patreon – https://www.patreon.com/keithgalli

If you enjoy this video, make sure to SUBSCRIBE to not miss future videos.

Checkout out my new channel where I will frequently be posting problems like these: https://www.youtube.com/channel/UCge9kgmp38FIjGK4xdJsThw/about

Feel free to recommend the next problems that I should solve on YouTube!

Links to problems:
LeetCode 1678: https://leetcode.com/problems/goal-parser-interpretation/
LeetCode 1436: https://leetcode.com/problems/destination-city/
LeetCode 1365: https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/
LeetCode 704: https://leetcode.com/problems/binary-search/
LeetCode 409: https://leetcode.com/problems/longest-palindrome/
LeetCode 1561: https://leetcode.com/problems/maximum-number-of-coins-you-can-get/
LeetCode 1472: https://leetcode.com/problems/design-browser-history/
LeetCode 1110: https://leetcode.com/problems/delete-nodes-and-return-forest/

————————-
Timeline!
0:00 – Introduction
2:02 – LeetCode 1678 – Goal Parser Interpretation
6:04 – LeetCode 1436 – Destination City
14:07 – LeetCode 1365 – How Many Numbers Are Smaller Than the Current Number
33:13 – LeetCode 704 – Binary Search
46:13 – LeetCode 409 – Longest Palindrome
55:01 – LeetCode 1561 – Maximum Number of Coins You Can Get
1:10:09 – LeetCode 1472 – Design Browser History
1:22:32 – LeetCode 1110 – Delete Nodes And Return Forest
1:38:23 – Conclusion & Announcement!

————————-
Follow me on social media!
Instagram | https://www.instagram.com/keithgalli/
Twitter | https://twitter.com/keithgalli

————————-
If you are curious to learn how I make my tutorials, check out this video: https://youtu.be/LEO4igyXbLs

*I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.

  • 70 70 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

70 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. samyakchy Enlightened
    2021-01-18T04:07:42+00:00Added an answer on January 18, 2021 at 4:07 am

    Hey everyone! If you enjoy this video, I just created a new channel where I'll be posting problems like this pretty frequently. Check it out here: https://www.youtube.com/channel/UCge9kgmp38FIjGK4xdJsThw/about (will start posting when it hits 1000 subs)

    Also, we're getting so close to 100K!! So crazy. I really appreciate everyone's support and am super thankful to have a platform where the content can reach so many. Love ya'll!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. samyakchy Enlightened
    2021-01-18T14:06:30+00:00Added an answer on January 18, 2021 at 2:06 pm

    Thank you Keith

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  3. samyakchy Enlightened
    2021-01-18T14:08:54+00:00Added an answer on January 18, 2021 at 2:08 pm

    Nice I always wanted to be a good Uber hacker dude dudette

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  4. samyakchy Enlightened
    2021-01-18T14:19:21+00:00Added an answer on January 18, 2021 at 2:19 pm

    close to 100k lets gooo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  5. samyakchy Enlightened
    2021-01-18T14:49:09+00:00Added an answer on January 18, 2021 at 2:49 pm

    awesome!! btw congrats on 100k soon!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  6. samyakchy Enlightened
    2021-01-18T14:53:17+00:00Added an answer on January 18, 2021 at 2:53 pm

    NEAT!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  7. samyakchy Enlightened
    2021-01-18T15:17:44+00:00Added an answer on January 18, 2021 at 3:17 pm

    Hey Keith love your content👍, Can you do maybe a series of videos on algorithms in python

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  8. samyakchy Enlightened
    2021-01-18T15:22:46+00:00Added an answer on January 18, 2021 at 3:22 pm

    Thank you, Keith! Best lessons , as usual!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  9. samyakchy Enlightened
    2021-01-18T15:29:09+00:00Added an answer on January 18, 2021 at 3:29 pm

    Thankyou so much Keith! I just learned how to approach a problem. You made it looked so easy. Please post more content like this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  10. samyakchy Enlightened
    2021-01-18T15:39:44+00:00Added an answer on January 18, 2021 at 3:39 pm

    Did he get a haircut?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  11. samyakchy Enlightened
    2021-01-19T01:21:21+00:00Added an answer on January 19, 2021 at 1:21 am

    Love this!!! Pls more content in this direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  12. samyakchy Enlightened
    2021-01-19T01:38:22+00:00Added an answer on January 19, 2021 at 1:38 am

    Thank you so much

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  13. samyakchy Enlightened
    2021-01-19T08:22:57+00:00Added an answer on January 19, 2021 at 8:22 am

    Great video! , but can you make a video on data structure and algorithms because I understand from you way better than any other YouTube channel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  14. samyakchy Enlightened
    2021-01-20T02:12:47+00:00Added an answer on January 20, 2021 at 2:12 am

    I love my own solution to the second question on Destination City. I simply returned the cityB that doesn't occur anywhere else in the whole list.

    class Solution:
    def destCity(self, paths: List[List[str]]) -> str:
    for path in paths:
    lister = [x for x in paths if x != path]
    if not (any(path[1] in listeri for listeri in lister)):
    return path[1]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  15. samyakchy Enlightened
    2021-01-20T07:58:01+00:00Added an answer on January 20, 2021 at 7:58 am

    Bro PLZZ do continue this series….each week please do post 1hr videos on leetcode python solutions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  16. samyakchy Enlightened
    2021-01-21T00:18:41+00:00Added an answer on January 21, 2021 at 12:18 am

    Thanks keith. I've been looking for content like this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  17. samyakchy Enlightened
    2021-01-25T22:33:00+00:00Added an answer on January 25, 2021 at 10:33 pm

    In example 1365 you could've changed: if j != i to: if j < i that would have made it right. Dont ask me why, lol. I cant come up with an answer for that since < is "less than"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  18. samyakchy Enlightened
    2021-01-27T14:39:08+00:00Added an answer on January 27, 2021 at 2:39 pm

    Thank you Keith for great Videos. A couple of suggestions: If you can dissect the problems, that would be great. E.g. String command = string method in Python. In order to solve this problem, you need to know class, string methods, replace() and functions. Here are the links for class,…,functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  19. samyakchy Enlightened
    2021-01-28T01:50:16+00:00Added an answer on January 28, 2021 at 1:50 am

    If you aren’t subbed to Keith’s new channel you are missing out on big brain learning

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  20. samyakchy Enlightened
    2021-01-30T12:14:46+00:00Added an answer on January 30, 2021 at 12:14 pm

    Dude , people are gonna think you are u/deepfuckingvalue .
    The guy who started the GME🚀🚀🚀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  21. samyakchy Enlightened
    2021-01-30T15:07:15+00:00Added an answer on January 30, 2021 at 3:07 pm

    Do you have any suggestions for the GME thing for me? Im getting started on this crap

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  22. samyakchy Enlightened
    2021-01-30T18:46:31+00:00Added an answer on January 30, 2021 at 6:46 pm

    Loved this 🔥 please do more of such leetcode questions. Let's hit that 100k and 1k😁

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  23. samyakchy Enlightened
    2021-02-16T07:22:46+00:00Added an answer on February 16, 2021 at 7:22 am

    Love your videos. Each time you upload a new one, its just like you read my mind and give me exactly what I need to become a data scientist. Please do a SQL tutorial or even better a "real world" example of how using SQL together with Python. Greetings from Sweden

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  24. samyakchy Enlightened
    2021-03-04T21:39:43+00:00Added an answer on March 4, 2021 at 9:39 pm

    For the binary search question, couldnt you just do something like

    try:
    return (nums.index(target))
    except:
    return "-1"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  25. samyakchy Enlightened
    2021-03-10T18:42:58+00:00Added an answer on March 10, 2021 at 6:42 pm

    Hey Keith more videos on leetcode please, this video is super awesome, love the way how you explain each and every step, please do more videos on leetcode thank you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  26. samyakchy Enlightened
    2021-03-31T23:26:18+00:00Added an answer on March 31, 2021 at 11:26 pm

    For smallerNumbersThanCurrent() could you get rid of the if statement and just overwrite the dictionary values, because the last overwrite will be the correct one to save. Or does writing to a dictionary take more time than the if statement to check?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  27. samyakchy Enlightened
    2021-04-23T15:18:53+00:00Added an answer on April 23, 2021 at 3:18 pm

    Hi Keith,

    This is nit picking but in for i in range(len(x)) loops are anti-patterns, for index,value in enumerate(iterable), is the pythonic way to access the index in a for loop

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  28. samyakchy Enlightened
    2021-05-04T02:36:55+00:00Added an answer on May 4, 2021 at 2:36 am

    loved how you have labeled each segment of the video with the corresponding problem title , keep up the great work !!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  29. samyakchy Enlightened
    2021-05-19T06:39:54+00:00Added an answer on May 19, 2021 at 6:39 am

    Thank you, you are the best

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  30. samyakchy Enlightened
    2021-06-20T08:04:58+00:00Added an answer on June 20, 2021 at 8:04 am

    Great job Keith! Thanks a lot.
    In case someone finds the maxCoin solution too confusing with all those i and indexes, here is simpler one I came up with:
    def maxCoins(piles):

    sorted_piles = sorted(piles)

    # sorted = [1, 2, 3, 4, 5, 6, 7, 8, 9]

    my_score = 0

    while len(sorted_piles) > 0:

    del sorted_piles[-1] #deleting the biggest

    my_score += sorted_piles.pop(-1)

    del sorted_piles[0] #deleting the smallest

    return my_score

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  31. samyakchy Enlightened
    2021-06-22T11:06:52+00:00Added an answer on June 22, 2021 at 11:06 am

    Hey Keith, well done video!
    For the palindrome problem, your solution wouldn't work properly if you have 2 different characters with odd number of appearances, you would add both of them to the count while only one could be used as the palindrome "center"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  32. samyakchy Enlightened
    2021-08-05T18:34:42+00:00Added an answer on August 5, 2021 at 6:34 pm

    I have an interview as an intern at amazon on the 11th I will comment if I made it or not wish me luck!!! I haven't taken any alogirthm class before so I know this is going to be hard

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  33. samyakchy Enlightened
    2021-08-08T05:46:24+00:00Added an answer on August 8, 2021 at 5:46 am

    Good Video.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  34. samyakchy Enlightened
    2021-08-09T04:00:34+00:00Added an answer on August 9, 2021 at 4:00 am

    The very first problem of Goal Parser Interpretation, I made a mess.
    1. First I didn't read the question properly. My mind started thinking of different edge cases, wherein different words might be given as test inputs. (e.g. F()()t(ball), etc)
    2. I started looping over the string, I'm much habituated to loop over things which is the worst approach ever.
    3. I started trying to figure out to how to replace the single brackets without creating blank spaces.
    4. I never read the constraints properly.

    Thanks Keith for this video, it help me analyze my problems and I can start working on fixing those whilst attempting these interview questions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  35. samyakchy Enlightened
    2021-08-15T23:25:08+00:00Added an answer on August 15, 2021 at 11:25 pm

    Hey Keith or anyone care to explain what is going on in the function parameter(smallerNumberThanCurrent(self,nums …) I dont understand what is going on there.Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  36. samyakchy Enlightened
    2021-08-22T18:00:45+00:00Added an answer on August 22, 2021 at 6:00 pm

    a2
    class Solution:

    def destCity(self, paths: List[List[str]]) -> str:

    cat = []

    dog = []

    for i in range(0,len(paths)):

    cat.append(paths[i][0])

    dog.append(paths[i][1])

    for i in range(0,len(dog)):

    if dog[i] not in cat:

    return(dog[i])

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  37. samyakchy Enlightened
    2021-08-22T18:06:16+00:00Added an answer on August 22, 2021 at 6:06 pm

    a3
    class Solution:

    def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:

    cat = sorted(nums)

    lol = []

    for i in range(0,len(nums)):

    lol.append(cat.index(nums[i]))

    return(lol)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  38. samyakchy Enlightened
    2021-08-27T02:58:12+00:00Added an answer on August 27, 2021 at 2:58 am

    For 1561 maximum number of coins:

    piles.sort()
    c = -2
    result = 0
    for i in range(len(piles)//3):
    result += piles[ c ]
    c -= 2
    return result

    Or in for loop
    piles.pop()
    result += piles.pop()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  39. samyakchy Enlightened
    2021-08-28T14:17:48+00:00Added an answer on August 28, 2021 at 2:17 pm

    He got drake eye brows

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  40. samyakchy Enlightened
    2021-09-03T03:50:42+00:00Added an answer on September 3, 2021 at 3:50 am

    confused on how in the example [-1,3,4,6,8,9,12,15,18] if the target is 10, it would break out of the while loop instead of being stuck inside the while loop

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  41. samyakchy Enlightened
    2021-09-03T06:30:40+00:00Added an answer on September 3, 2021 at 6:30 am

    Love the video, but I dont think the longest palindrome problem is fully correct because if you have 2 instances of odd characters, you would need to only add the count of the largest number of a specific odd character. EX: "abbccccddeee" would need to ignore the odd "a" character but instead would include the 3 odd "e" characters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  42. samyakchy Enlightened
    2021-09-05T13:19:09+00:00Added an answer on September 5, 2021 at 1:19 pm

    interesting and tricky little prob:

    def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
    result = []
    for i in range(len(nums)):
    targets = [1 for (idx,x) in enumerate(nums) if idx != i and x < nums[i]]
    result.append(sum(targets))
    return result

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  43. samyakchy Enlightened
    2021-09-05T17:14:16+00:00Added an answer on September 5, 2021 at 5:14 pm

    Thank you, learned a lot from this video, Please post more videos

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  44. samyakchy Enlightened
    2021-09-07T14:09:12+00:00Added an answer on September 7, 2021 at 2:09 pm

    Excellent video! Greatly helped me. Thank you very much!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  45. samyakchy Enlightened
    2021-09-10T22:38:57+00:00Added an answer on September 10, 2021 at 10:38 pm

    Destination City

    out_city = {path[0] for path in paths}

    for path in paths:
    if path[1] in out_city.keys():
    out_city.pop(path[1])

    The only remaining key would be the answer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  46. samyakchy Enlightened
    2021-10-16T08:11:22+00:00Added an answer on October 16, 2021 at 8:11 am

    If the language is Python and you are allowed to 'use' Python, for question 704. Binary Search my initial thought was 'return nums.index(target)'. Why reinvent the wheel unless it was specified that the solution should be faster than the built-in function. Great video and this did definitely get the brain thinking about possible solutions and ways to improve them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  47. samyakchy Enlightened
    2021-10-25T15:35:11+00:00Added an answer on October 25, 2021 at 3:35 pm

    for the 1436, the key point is using hash table.
    def destCity(self, paths: List[List[str]]) -> str:
    citiesA = {path[0] for path in paths}
    return next(path[1] for path in paths if path[1] not in citiesA)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  48. samyakchy Enlightened
    2021-10-28T19:13:50+00:00Added an answer on October 28, 2021 at 7:13 pm

    Que vídeo incrível. Surreal. Muito didático até para mim, brasileiro.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  49. samyakchy Enlightened
    2021-11-05T17:46:49+00:00Added an answer on November 5, 2021 at 5:46 pm

    My solution was:
    If the second index of any pair does not exist as the source of any other pairs, then that's the city.

    def destCity(self, paths: List[List[str]]) -> str:

    src=[]

    dst=[]

    for x in paths:

    src.append(x[0])

    dst.append(x[1])

    for d in dst:

    if not (d in src):

    return d

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  50. samyakchy Enlightened
    2021-11-08T22:28:25+00:00Added an answer on November 8, 2021 at 10:28 pm

    Great video!
    Please note the middle can overflow. Thus, we prefer to use mid=start+(end-start) / 2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  51. samyakchy Enlightened
    2021-11-09T09:25:45+00:00Added an answer on November 9, 2021 at 9:25 am

    Hi, I tried the sharing between friends question but got no output
    data = [2, 4, 1, 2, 7, 8]
    Alice = 0
    Roso = 0
    Bob =0

    def split_data(data, Alice, Roso, Bob):
    share = len(data)//2
    while len(data) != 0:
    Alice += data[0]
    Roso += data[1]
    Bob += data[2]
    return Alice
    return Roso
    return Bob

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  52. samyakchy Enlightened
    2021-11-12T13:50:08+00:00Added an answer on November 12, 2021 at 1:50 pm

    Thank you very much for the video, it helped a lot !!(:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  53. samyakchy Enlightened
    2021-11-23T20:39:36+00:00Added an answer on November 23, 2021 at 8:39 pm

    You miss the use of a lot of simple, easy to read builtins

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  54. samyakchy Enlightened
    2021-12-03T04:08:12+00:00Added an answer on December 3, 2021 at 4:08 am

    For Second Solution, I simply converted the nested list to the dictionary and iterated the dictionary to find the city which is not a key in that dictionary :

    cities = dict(cities)

    #{'London': 'New York', 'New York': 'Lima', 'Lima': 'Sao Paulo'}

    for city in cities.values() :

    if city not in cities.keys() :

    return city

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  55. samyakchy Enlightened
    2021-12-10T11:34:15+00:00Added an answer on December 10, 2021 at 11:34 am

    SIMPLE SOLUTION:

    a=[8,1,2,2,3]

    m=[]

    b=0

    for i in range(0,len(a)):#0 to 4

    for j in range(0,len(a)):#0 to 4

    if a[i]>a[j]:

    b+=1

    m.append(b)

    b*=0

    print(m)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  56. samyakchy Enlightened
    2022-01-13T17:15:16+00:00Added an answer on January 13, 2022 at 5:15 pm

    Thank you for doing this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  57. samyakchy Enlightened
    2022-01-13T17:16:59+00:00Added an answer on January 13, 2022 at 5:16 pm

    We love the way you did this. I prefer this approach over youtubers that clearly comes prepared and solve it with no hesitancy and in a bit of complex way

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  58. samyakchy Enlightened
    2022-01-16T04:23:05+00:00Added an answer on January 16, 2022 at 4:23 am

    Ok, this one works in my condition

    class Solution:
    def destCity(self, paths):#: List[List[str]]) -> str:
    going_count = {}
    for i in paths:
    [*cities] = i
    for j in range(len(cities)-1):
    going_count[cities[j]] = going_count.get(cities[j], 0) + 1
    going_count[cities[-1]] = 0

    print(going_count)

    dest = []

    for city in going_count:
    if going_count[city] == 0:
    dest.append(city)

    return dest

    paths = [['a', 'b', 'c', 'd'], ['a', 'c', 'e', 'f'], ['b', 'c', 'f'], ['d', 'j']]#, ['d', 'c']] # should not use dict

    solution = Solution()
    solution.destCity(paths)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  59. samyakchy Enlightened
    2022-01-27T05:19:14+00:00Added an answer on January 27, 2022 at 5:19 am

    Very informative content. It’d be even more awesome if you could explain a little more in depth for beginners

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  60. samyakchy Enlightened
    2022-01-31T06:59:59+00:00Added an answer on January 31, 2022 at 6:59 am

    For 33:13 – LeetCode 704 – Binary Search,this is the most optimal solution.
    class Solution(object):
    def search(self, nums, target):
    return -1 if target not in nums else nums.index(target)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  61. samyakchy Enlightened
    2022-02-23T15:40:45+00:00Added an answer on February 23, 2022 at 3:40 pm

    you're brilliant bro. The way you think really helps me understand how to solve these questions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  62. samyakchy Enlightened
    2022-03-13T17:27:37+00:00Added an answer on March 13, 2022 at 5:27 pm

    If we are appending the root to the output array in each iteration. How did we end up having subarrays in the output ? This confused me any help is appreciated

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  63. samyakchy Enlightened
    2022-04-08T10:10:41+00:00Added an answer on April 8, 2022 at 10:10 am

    im not smart enough for this : ( are these really easy?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  64. samyakchy Enlightened
    2022-04-27T19:13:53+00:00Added an answer on April 27, 2022 at 7:13 pm

    18:00 Mistakes are a part of the process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  65. samyakchy Enlightened
    2022-05-11T17:24:01+00:00Added an answer on May 11, 2022 at 5:24 pm

    I applied for an SRE role with a company but they also wanted someone with some Python experience, other than building speech to text chatbots and local Jarvis virtual assistants I've never worked with Python on this type of level. I did horribly on the assessment which lead me to this video. Don't know why but I cannot wrap my head around this binary, data parsing or algorithm stuff with Python, it's next level type stuff… Big ups to all that understand this, I think I'll just stick with bash scripting and IAC- Orchestration/Automation and API's using Terraform, Ansible, Packer 😒

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  66. samyakchy Enlightened
    2022-05-19T09:37:18+00:00Added an answer on May 19, 2022 at 9:37 am

    Thanks Kieth for so many insights.
    However, for LongestPalindrome, I think the solution won't work for input 'aaabbb', i.e., when more than one letter have odd count

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  67. samyakchy Enlightened
    2022-06-01T18:04:48+00:00Added an answer on June 1, 2022 at 6:04 pm

    I think when index method won’t override if it encounters the same element in the list. here is my solution to the 3rd problem @25:00

    def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
    sorted_nums = sorted(nums)
    d = {}
    lst = []
    for num in sorted_nums:
    d[num] = sorted_nums.index(num)
    for num in nums:
    lst.append(d[num])
    return lst

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  68. samyakchy Enlightened
    2022-06-18T07:16:24+00:00Added an answer on June 18, 2022 at 7:16 am

    This is very helpful. more of these please!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  69. samyakchy Enlightened
    2022-06-20T00:58:33+00:00Added an answer on June 20, 2022 at 12:58 am

    Great tutorial..thankyou..how does self.history[0: self.current_index] clears history in the Design browser history problem? This seems to be creating a substring of array from 0 to current_index. Please clarify

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  70. samyakchy Enlightened
    2022-07-04T00:30:39+00:00Added an answer on July 4, 2022 at 12:30 am

    destination city : (easier way) lazy way 😛

    paths = [["London","New York"],["New York","Lima"],["Lima","Sao Paulo"]]

    dic = dict(paths)

    origin = list(dic.keys())

    destination = list(dic.values())

    ans = set(destination).difference(set(origin))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 2k
  • Answers 30k
  • Best Answers 2
  • Users 2
  • Popular
  • Answers
  • samyakchy

    AWS Tutorial For Beginners | AWS Full Course - Learn ...

    • 100 Answers
  • samyakchy

    CODING DECODING Reasoning Tricks in Hindi | सिर्फ 1 ही ...

    • 100 Answers
  • samyakchy

    Microservices Full Course - Learn Microservices in 4 Hours | ...

    • 100 Answers
  • Nomad Lokesh
    samyakchy added an answer 2:57:38 August 11, 2022 at 5:00 pm
  • Nomad Lokesh
    samyakchy added an answer 2:53:00 August 11, 2022 at 4:51 pm
  • Soumyadeep Bhowmick
    samyakchy added an answer 5:55:00 call by reference August 11, 2022 at 4:47 pm

Top Members

samyakchy

samyakchy

  • 453 Questions
  • 437 Points
Enlightened
moderator

moderator

  • 0 Questions
  • 21 Points
Begginer

Trending Tags

analytics british company computer developers django employee employer english facebook french germany google interview javascript language life php programmer programs salary university А Алкоголизм Алкоголь Алкогольная Анонимный Аппараты Аргументы Белая Белка Белоярка Бинарное Битва Богородская Больница Бывает В Вакуумный Видео Воронеж Г Где Гипноз Голавль Если Есть Женский Жизнь Житомир Закидушка Закодироваться Занятия Зимняя Избавления Исследования Как Какая Какими Какую Калуга Карп Клиника Когда Кодировка Консультация Лекарства Лекарство Лечение Лечений Личные Лучшее Лучшие Мантра Медикаментозное Медикаменты Метронидазол Может Муж На Надежда Народные Настойка Нижняя Отзывы Подострые После Постабстинентный Почему Препарат При Приманка Применяемые Продукты Противопоказания Пусть Ростов С Сколько Слабительные Снимаем Советы Современные Созависимость Состояние Статьи Стоимость Таблетки Тактика Тест Ты Убрать Уровень Феварин Форум Цена Челябинск Щука Эффективные Як абстинентный алкоголизма алкоголизме алкоголики алкогольного алкогольной алкогольные алкоголя аптеках бабка балансиром банками без белуги берега беременность берша блеснами блесной блесну блёсна бойл бойлы боярышника бросил бычка весной весною во воблером воблеры воблы водку волга вредные время всего выздоровления вылечить ггт гипнозом глубине говорят голавля горбуши горбушу горячка давай давление давлении делать дети джиг для донку донную дону елец ельца жереха жерлицу живца за зависимость задачи закодировать запоя зимнего зимней зимнюю зимой зимою знахарок и избавился использовать июне какие каких какого какое какой каком камбалу камбалы камышах карась карася каролинскую карпа карпов кеты кефали кефаль клюет кодирование кодировании кодирования кодировке кодируют колме кольцо комбайном кораблик кормушку корюшки которые крабов кружки крупной крупный крючки кто кумжи ленка летней летом лечат лечении лечению лечения лечить лещ леща ли линя ловит ловити ловится ловить ловиться ловля ловят лодки лососевых лучше льда любисток любистоком людей массаж массажа мать медицинские между месяца методы можно молочных море мормышки мормышку мужчин мурманская мушку наживка наживки наживку налима налимов научится нахлыстом начале начинается не нельзя ночью нужно нужны о обруча обручей озерах озере окуней окуня омуля осенью осетров оснастка от падает палочкой пей пелядь пескаря пивной пить плотву плотвы по погоду подлещика подуста поймать полбина поплавок правельно правильно препараты прикормка приманки приманку применяемый принимать причинах пробку против профилактике пружиной психозы пули пьет размера раколовками ранней рвотное резинке речная рождаются ротана ротанов руками рыба рыбалка рыбу рыбы сазана сало сарган сбор сейчас селедки семги семгу сига сильного синдром случаях снасть снастями снижающий со сома сомика сорожки спб спиннинг спиннингом средства средство ставрида ставриды стационар стерляди стерлядку стоит судак судака тайменя тарани твичингом толстолобика трав трава травы трески треску тягу у удочкой удочку уклейки ульяновск устала фарш фельдшера фидер фидером финском форели форель хариуса хищника хищной целлюлит целлюлита че чебака чего человека чем червя черном черноморской черта чехони чехонь числа что чтобы шот щук щуки щуку экстрасенсов язя

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • New Questions
  • Trending Questions
  • Must read Questions
  • Hot Questions

Footer

MeroLearning

MeroLearning is a social questions & Answers Engine which will help you establish your community and connect with other people.

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 MeroLearning. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.