Hearing about leetcode from the leetcode master (happy new year my friends 😄)
https://youtu.be/h3nV3I9F2hA?si=5O8Tc4FAMxN7y4NY
https://youtu.be/h3nV3I9F2hA?si=5O8Tc4FAMxN7y4NY
YouTube
Should you grind LeetCode? feat. NeetCode | 051
In today’s episode, we bring fellow developer and tech content creator NeetCode, to talk about his obstacles and observations on his path in becoming a FAANG engineer, where he shares his struggles and how he started both his tech career and content creation…
👍2
Forgot to say happy new year 😅
In this year I have planned to make more engaging contents on the channel.
We will have:
- Live streams in different topics with special guests
- Virtual Contests
- Live Coding
- Interesting Projects
Wait for more share to your friends and get ready 😁👍
@codative
In this year I have planned to make more engaging contents on the channel.
We will have:
- Live streams in different topics with special guests
- Virtual Contests
- Live Coding
- Interesting Projects
Wait for more share to your friends and get ready 😁👍
@codative
🔥7🤔2
Codative 🔭 pinned «Forgot to say happy new year 😅 In this year I have planned to make more engaging contents on the channel. We will have: - Live streams in different topics with special guests - Virtual Contests - Live Coding - Interesting Projects Wait for more share…»
Forwarded from Techኢት (Alpha)
Practice system design problems like you practice DSA on Leetcode
Found this awesome platform on Reddit for practicing system design actively. Watching videos and reading books can get boring, but this site lets you dive right in. Give it a try! Here's the link.
Source: Reddit
@techinethio
#foundthis #systemdesign
Found this awesome platform on Reddit for practicing system design actively. Watching videos and reading books can get boring, but this site lets you dive right in. Give it a try! Here's the link.
Source: Reddit
@techinethio
#foundthis #systemdesign
🔥3
I was looking this week on the codenight forum go topic and there was a hot argument about using pure sql or using orm for handling models and database things what is your idea about this 😄
I was crazy and thinking to make a library that can make github as a storage for syncing user data 😄 what do you think?🙄
Hey people do you want to join developers community arround the world here is one on slack and it is all about go I will try to find others that are more general. Since these kind of networks are really crucial for your career as software developer I highly recommend you to really join them and I will send much more like this soon
Gophers
@codative
Gophers
@codative
👍3👏1
Codative 🔭 pinned «Hey people do you want to join developers community arround the world here is one on slack and it is all about go I will try to find others that are more general. Since these kind of networks are really crucial for your career as software developer I highly…»
Ever missed contests on many platform and wondered how to get them. There is a good solution for me which gives you all of the upcoming and previous contests on every competitive programming platform. It is called CodeClock and it lets u add the contest that you want to your calendar and you will never miss any again
Have You Ever Got Stuck Comparing Values in Python Sorting? Meet cmp_to_key!
If you've been solving problems on LeetCode or coding challenges in general, you’ve probably faced a situation where you need custom sorting logic—like sorting based on multiple conditions. This is where Python's cmp_to_key comes in, and it can save the day!What is cmp_to_key?Imagine you have a comparison function that says,
This is called a comparison function (cmp). But modern Python sorting methods like sorted() or .sort() use a key function instead.So how do you use your custom cmp function with sorted()? Simple—convert it using cmp_to_key!
Example:
Sorting Strings by Length, Then AlphabeticallyLet’s say you need to sort a list of words. First, by length. If two words have the same length, you sort them alphabetically.
Without cmp_to_key, writing such sorting logic can get messy. But here, you just write your comparison function, and cmp_to_key handles the rest.Example: Custom Sorting NumbersLet’s sort a list of numbers where we want even numbers first, sorted in descending order, and odd numbers second, sorted in ascending order.
How Does It Work?
If a should come before b, return -1.If a and b are equal, return 0.If a should come after b, return 1.
#tips #leetcode #python
@codative
If you've been solving problems on LeetCode or coding challenges in general, you’ve probably faced a situation where you need custom sorting logic—like sorting based on multiple conditions. This is where Python's cmp_to_key comes in, and it can save the day!What is cmp_to_key?Imagine you have a comparison function that says,
If this value is smaller than that, return -1; if they're equal, return 0; if it's bigger, return 1.
This is called a comparison function (cmp). But modern Python sorting methods like sorted() or .sort() use a key function instead.So how do you use your custom cmp function with sorted()? Simple—convert it using cmp_to_key!
Example:
Sorting Strings by Length, Then AlphabeticallyLet’s say you need to sort a list of words. First, by length. If two words have the same length, you sort them alphabetically.
from functools import cmp_to_key
def compare(a, b):
if len(a) == len(b):
return -1 if a < b else 1 # Compare alphabetically if lengths are equal
return len(a) - len(b) # Compare by length
words = ["apple", "bat", "banana", "pie", "cat"]
sorted_words = sorted(words, key=cmp_to_key(compare))
print(sorted_words) # Output: ['bat', 'cat', 'pie', 'apple', 'banana']Without cmp_to_key, writing such sorting logic can get messy. But here, you just write your comparison function, and cmp_to_key handles the rest.Example: Custom Sorting NumbersLet’s sort a list of numbers where we want even numbers first, sorted in descending order, and odd numbers second, sorted in ascending order.
def custom_compare(a, b):
if a % 2 == b % 2: # Both even or both odd
return b - a if a % 2 == 0 else a - b # Descending for evens, ascending for odds
return -1 if a % 2 == 0 else 1 # Even before odd
numbers = [3, 1, 4, 10, 5, 6, 7]
sorted_numbers = sorted(numbers, key=cmp_to_key(custom_compare))
print(sorted_numbers) # Output: [10, 6, 4, 1, 3, 5, 7]How Does It Work?
If a should come before b, return -1.If a and b are equal, return 0.If a should come after b, return 1.
#tips #leetcode #python
@codative
👍1