Newbie


Гео и язык канала: не указан, не указан
Категория: не указана


This is my journey as a tech enthusiast and beginner! Here, I share my software projects, discuss daily LeetCode challenges, review books, and sprinkle in some motivational quotes.

Связанные каналы

Гео и язык канала
не указан, не указан
Категория
не указана
Статистика
Фильтр публикаций




So, Is it really Friday today?
What happened to Wednesday, Thursday and all the other days?😐






That moment when you're መመሳሰጥing by the taxi window, wind in your hair, favorite song playing, and the person next to you suddenly shuts the window.


Everything fails all the time, so plan for failure and nothing fails.
Werner Vogels


🌟 Today's Challenge 🌟

1653. Minimum Deletions to Make String Balanced📏🔡

❔ Problem: Given a string s consisting of only "a" and "b", return the minimum number of deletions needed to make the string balanced (all 'a's come before 'b's).

➡️ Solution: Somehow the same as yesterday's one. Instead of counting in every iteration (which would lead to O(n^2) time complexity), I created prefix arrays for both 'a' counts and 'b' counts. Here's how it works:

I made two prefix arrays:

prefix_a[i]: The number of 'a's from the start up to index i.
prefix_b[i]: The number of 'b's from the start up to index i.

Iterate Through the String: For every character in the string, I calculated:
a_count_after: The number of 'a's after the current position (total 'a' count - prefix_a[i]).
b_count_before: The number of 'b's before the current position (prefix_b[i]).

For each position, the number of deletions needed to make the string balanced at that point is the sum of a_count_after and b_count_before. I kept track of the minimum deletions required.

📊 Time Complexity: O(n)
📂 Space Complexity: O(n)
https://leetcode.com/problems/minimum-deletions-to-make-string-balanced/description/?envType=daily-question&envId=2024-07-30

#Leetcode #DailyChallenge


You can break my heart in two
But when it heals it beats for you...


How stable is your self-worth, regardless of your achievements or failures?
Опрос
  •   Very stable
  •   Mostly stable
  •   Somewhat stable
  •   Not very stable
  •   Unstable
24 голосов


🌟Today's hub daily🌟
826. Most Profit Assigning Work

❔ Problem: Given n jobs, m workers, and three arrays: difficulty, profit, and worker:
difficulty[i] and profit[i] are the difficulty and profit of the i-th job.
worker[j] is the max difficulty the j-th worker can work.
Each worker can be assigned at most one job, but a job can be completed multiple times. we need to return the maximum profit we can achieve after assigning the workers to the jobs. 👨‍💼🧑‍💼

➡️ Approach:

Map Profit to Minimum Difficulty: Create a dictionary mapping each profit to the minimum difficulty required to achieve it.
Sort Workers: Sort the worker array in descending order. s
Use a Max Heap: Convert the profit array into a max heap (by using negative values).
Calculate Total Profit: Iterate over the workers and calculate the total profit they can achieve based on their abilities(by heappopping the maximum profit and assigning it to the the ith worker...since the workers are sorted in descending order of their ability, we're guarreteed of not missing out an opportunity to assign high profitable job to the cabable worker)

📊 Time complexity: O(nlogn + mlogm) the sorting part and the heap operation
📂 Space complexity:O(n)... the dictionary
https://leetcode.com/problems/most-profit-assigning-work/

#Leetcode #DailyChallenge #Heap #Sorting


🌟 Today's Challenge 🌟

1395. Count Number of Teams

❔ Problem: Given an array rating of soldiers' ratings, determine the number of valid teams of three soldiers where the ratings form either an increasing or decreasing sequence.👨‍🚀👩‍🚀

After watching Neetcode's explanation, the "treating every number as a middle number" approach felt familiar, right? It's similar to how we solved problem 2222, "Number of Ways to Select Buildings."

Iterate through the ratings array: Treat each soldier as the middle soldier.
Count elements on the left:
◀ 🔽 left_less: Number of soldiers with ratings less than the current soldier.
◀ 🔼 left_greater: Number of soldiers with ratings greater than the current soldier.
Count elements on the right:
➡ 🔽 right_less: Number of soldiers with ratings less than the current soldier.
➡ 🔼 right_greater: Number of soldiers with ratings greater than the current soldier.
➕ Calculate combinations:
Multiply left_less by right_greater for increasing sequences.
Multiply left_greater by right_less for decreasing sequences.
Add these values up for the total count.
📊 Time Complexity: O(n²)
📂 Space Complexity: O(1)
https://leetcode.com/problems/count-number-of-teams/description/?envType=daily-question&envId=2024-07-29

#Leetcode #DailyChallenge




Репост из: Techኢት
Techኢት Podcast S02E07🎙

Guest: Bereket Engida(Telegram)
Host: Tolosa
Date: July 30, 2024
Time: 8:00 PM (2:00LT)

We're excited to feature Beka on Techኢት Podcast! 🎉 Beka is a top developer known for turning unique ideas into reality and solving real-life problems with code. 🚀

Projects💻✨
Loglib:Privacy-first, open-source web analytics.🔒📊
Better Fetch:Efficient data-fetching library.🌐⚡️
Better Call: Enhances remote procedure call functionality. 📞🔧
And more!

Current Role:
Beka currently contributes to Read21 as a remote developer, working on a multi-sensory web application designed to assist struggling readers and students with dyslexia. 📚🌍Additionally, he develops for Elemental, a local company.🏢🔧

✅Apart from his coding endeavors, Beka is also a talented music producer, specializing in creating music for adverts and film scores.🎶🎬

Don't miss out on this fun episode! 🤩 We'll dive into Beka's tech journey, uncover his innovative projects, and learn how he juggles roles at Read21 and Elemental. Plus, we'll geek out on tech trends and soak up his wisdom for budding developers. 🌟💡

@Techinethio
📅 Stay tuned! 🎧📢✨
#TechኢትPodcast


What excites you? Or what are your hobbies? It's to try others' hobbies and see if I enjoy them. Please write them in the comment below.
If you're uncomfortable to write them in the comment,
Send anonymously here
Thanks


Hey everyone!

ChuchAI is now deployed. check it out here.

I had to remove some features that require transformers due to the size limitations of serverless sites deployed on Vercel...it's baically key word matching
so it's still chuche AI🙁




📚 Book Review: The 4-Hour Workweek by Timothy Ferriss 📚

We're back with another book review! 🎉

The main idea of the book is : instead of waiting for retirement, we should use frequent breaks throughout our careers to do what we’ve always dreamed of doing. To be honest, I found most of the strategies in this book to be something to apply in the future. However, these are the main takeaways:

Main Takeaways
Lifestyle Design 🌟: Ferriss encourages us to build our lives around our dreams rather than fitting into societal expectations.

Less Is Not Laziness : Doing less meaningless work so that you can focus on things of greater personal importance is NOT laziness. This is hard for most to accept because our culture tends to reward personal sacrifice instead of personal productivity.

80/20 Rule 🎯: Focus on the 20% of activities that bring 80% of the results and eliminate the rest.

Doing the Unrealistic Is Easier Than Doing the Realistic 🚀: It’s lonely at the top. Ninety-nine percent of people in the world are convinced they are incapable of achieving great things, so they aim for the mediocre. The level of competition is thus fiercest for “realistic” goals.

The question you should be asking isn’t, "What do I want?" or "What are my goals?" but "What would excite me?"

Challenge the Status Quo 🤔: If everyone is solving a problem one way and the results are subpar, it’s time to ask, "What if I did the opposite?" Don’t follow a model that doesn’t work. If the recipe sucks, it doesn’t matter how good a cook you are.

Emphasize Strengths, Don’t Fix Weaknesses 💪: Focus on leveraging your strengths rather than fixing your weaknesses.

Ask for Forgiveness, Not Permission 🙏: If it isn’t going to devastate those around you, try it and then justify it.

Effectiveness vs. Efficiency 🕒: Effectiveness is doing the things that get you closer to your goals. Efficiency is performing a given task (whether important or not) in the most economical manner possible. Being efficient without regard to effectiveness is the default mode of the universe.

Outsourcing 🤖: Delegate tasks to virtual assistants to boost productivity. This can free up your time to focus on more important tasks.

He also shares tactics to deal with interrupters.

Overall, The 4-Hour Workweek is filled with thought-provoking ideas and practical advice for anyone looking to optimize their work-life balance. It challenges conventional work rules and encourages you to design a life you truly want to live.

#BookReview #The4HourWorkweek


🌟 Today's Challenge 🌟
2976. Minimum Cost to Convert String I

❔ Problem: Given 2 strings source and target and two arrays original and changed, and an integer array cost, where cost[i] represents the cost of changing the character original[i] to the character changed[i], The task is to find the minimum cost to change the source string to target.

➡️ It is pretty much the same as yesterday's one, right? so I did the same thing and got TLE....cuz I was calling the dijkstras function for every character in source...which is inefficient because of the repetitive work. so we need to store the results of transformations to avoid redendant computation...the other thing is the same.

📊 Time Complexity: O(n^2 * log(n))
📂 Space Complexity: O(n^2)
https://leetcode.com/problems/minimum-cost-to-convert-string-i/
#LeetCode #DailyChallenge #DijkstrasAlgorithm #Heap #Hashmap

🌟 Today's Challenge 🌟
238. Product of Array Except Self
❔ Problem: Given an array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]...but without using division operator and with linear time complexity
➡️ this means...for every element, we need the product of elements before it and after it...where prefixsum(in this case prefix product) comes in to play....I did the prefix product in one iteration. And in other iteration, I did suffix product while also multiplying it with its corresponding prefix product

📊 Time Complexity: O(n)
📂 Space Complexity: O(n)
https://leetcode.com/problems/product-of-array-except-self/description/

#LeetCode #DailyChallenge #PrefixProduct


I am so sick of people saying "ተስማምቶሻል...ትምህርት አቆምሽ እንዴ?"😐😐😐😕😕
Please be informed that weight gain can also result from stress!🙄


Репост из: Debugging Epohul
After taking 15 minute walk for two consecutive days

Показано 20 последних публикаций.

68

подписчиков
Статистика канала