🚀 Day 62 of My Python & DSA Journey Today’s LeetCode problem was Ugly Number (263) — a simple yet interesting problem focused on number factorization. 🔍 Problem Solved: An Ugly Number is a positive number whose prime factors only include 2, 3, and 5. The task was to check whether a given number is an ugly number or not. 💡 Approach Used: • Keep dividing the number by 2, 3, and 5 • Remove all these factors • If the final number becomes 1, it's an ugly number • Otherwise, it's not ⚡ Key Learnings: • Understanding prime factorization • Using while loops effectively • Writing clean and efficient logic • Improving number-based problem solving 📊 Complexity Analysis: ✅ Time Complexity: O(log n) We continuously divide the number by 2, 3, and 5 ✅ Space Complexity: O(1) No extra space used 🎯 Why This is Efficient? Instead of checking all factors, we directly remove allowed prime factors, making the solution fast and clean. Under the Guidance of: Rudra Sravan kumar and Manoj Kumar Reddy Parlapalli #Day62 #Python #LeetCode #DSA #Algorithms #CodingJourney #100DaysOfCode 10000 Coders 🚀
Python LeetCode Ugly Number Solution
More Relevant Posts
-
🚀 Day 26 of My Python DSA Journey – Jump Game 🧠⚡ Today’s problem was a great example of how greedy thinking can simplify complex-looking problems. 📌 Problem You’re given an array where each element represents the maximum jump length from that position. 👉 Start at index 0 👉 Check if you can reach the last index 🔍 Approach I Used (Greedy) Instead of trying all possible jumps (which would be slow ❌), I tracked: ➡️ The farthest index I can reach at any point Steps: Initialize max_reach = 0 Traverse the array If current index > max_reach → ❌ cannot proceed Update: max_reach = max(max_reach, i + nums[i]) If max_reach reaches last index → ✅ done 💡 Key Learning ✔ Greedy approach avoids unnecessary computations ✔ Always track the maximum reachable position ✔ Early exit conditions make code efficient ✔ Not every problem needs DP or recursion ⏱ Complexity Time Complexity: O(n) Space Complexity: O(1) This problem taught me a big lesson: 👉 Sometimes the smartest solution is the simplest one. Consistency continues 🔥 #Python #DSA #GreedyAlgorithm
To view or add a comment, sign in
-
-
Day 58 of my #100DaysOfCode challenge 🚀 Today I implemented a Python program to generate prime numbers within a given range. This is a practical extension of prime checking and useful in many DSA and real-world problems. What the program does: • Takes a range (start, end) as input • Checks each number in the range • Identifies whether it is prime or not • Returns a list of all prime numbers in that range Example Output: Prime numbers between 1 and 50: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] How the logic works: Start from max(2, start) For each number: • Assume it is prime • Check divisibility from 2 → √n If divisible → not prime If not divisible → add to result list 👉 Uses square root optimization for better performance Why this is important: – Builds on prime number fundamentals – Useful in: Competitive programming Number theory problems Range-based queries – Helps understand optimization using √n Time Complexity: O(n√n) Space Complexity: O(k) (number of primes) Key Takeaways: – Applying optimized prime checking – Working with ranges and loops – Improving efficiency using √n – Writing clean and scalable code #100DaysOfCode #Day58 #Python #Programming #DSA #Algorithms #PrimeNumbers #NumberTheory #CodingPractice #ProblemSolving #InterviewPrep #Optimization #DeveloperJourney #Consistency #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
🚀 Day 81 – Mastering Date & Time in Python ⏰📅 Today’s learning journey was all about the datetime module — one of Python’s most practical tools for handling real‑world scenarios involving dates and times. 🔹 Current Date & Time – Practiced fetching the present moment with datetime.now(), a powerful way to anchor programs in real‑time. 🔹 Modification – Explored how to adjust dates and times, making it possible to calculate future or past events with ease. 🔹 Formatting with strftime – Learned how to present date and time in human‑friendly formats, turning raw data into readable output. 🔹 Parsing with strptime – Understood how to convert strings into datetime objects, bridging user input with program logic. 🔹 timedelta Magic – Discovered how to perform arithmetic on dates and times, enabling countdowns, schedules, and reminders. 🔹 Alarm Task – Applied these concepts to build a simple alarm, reinforcing how datetime can power real‑life applications. 🌱 Reflection – Working with time isn’t just technical; it’s about making programs responsive to the world around us. From reminders to logs, datetime is the backbone of time‑aware applications. ✨ Grateful to Ajay Miryala sir and the 10000 Coders team for guiding me through another essential building block in Python. ⚡ Day 81 was about turning abstract concepts into practical tools — learning to control time itself in code! #Day81 #PythonLearning #Datetime #CodingJourney #10000Coders #LearnInPublic #100DaysOfCode
To view or add a comment, sign in
-
🐍 Day 8 of Learning Python — and things are getting real! Today's lab was all about writing code that doesn't break (or at least fails gracefully 😄). Here's what I worked through: ✅ Exception Handling — try / except / else / finally • Caught ZeroDivisionError, FileNotFoundError, ValueError, and TypeError • Used `raise` to throw custom error messages • Built my own exception class: TooSmallError 🎉 ✅ Standard library deep dive: • math — calculated circle areas, factorials, GCD, and compound interest • random — shuffled lists, simulated 1000 coin flips, generated reproducible sequences with seed() • datetime — parsed date strings, added time deltas, sorted ISO dates, and printed 5-day schedules ✅ Introspection with dir() and help() The biggest lesson today? Real-life programs don't always get perfect input. Learning to handle errors gracefully is just as important as writing the happy path. Day by day, the pieces are coming together. 💪 #Python #100DaysOfCode #LearningToCode #PythonProgramming #CodingJourney #Day8
To view or add a comment, sign in
-
🚀 100 Days of Code – Restarting My Python Journey #Day29 of #100DaysOfCode Continuing my Python journey with 📘 “100 Days of Code: The Complete Python Pro Bootcamp” on Udemy by Angela Yu (London App Brewery). 🎯 Day 29 Project — Password Manager 🔐 Built a GUI-based password manager using Tkinter that can: - Generate strong, random passwords - Store credentials securely - Retrieve saved data when needed This project combined GUI development, file handling, and logic building to create a practical and usable application. 🔗 Check out my progress here: https://lnkd.in/gAufnQ8F One key takeaway: Building tools that solve real problems makes learning far more impactful. The focus remains: consistency + deep understanding + building in public. 💡 Small steps daily. Big results over time. More updates coming soon… stay tuned! #100DaysOfCode #Python #CodingJourney #LearnInPublic #DeveloperLife #GitHub #Consistency #Day29 #Udemy #BackToLearning #Tkinter
To view or add a comment, sign in
-
-
Day 3 of #100DaysOfCode – Python Practice Continues! Today I focused on improving my problem-solving skills with numbers and lists 🐍💡 📌 What I practiced today (Programs 26–40): 🔹 Number-based problems ✔️ Second largest element ✔️ Leap year check ✔️ Even & odd count ✔️ GCD & LCM ✔️ Armstrong number ✔️ Perfect number ✔️ Count digits ✔️ Factors of a number 🔹 List-based problems ✔️ Reverse a list ✔️ Merge two lists ✔️ Find common elements ✔️ Remove element from list ✔️ Frequency of elements ✔️ Check if list is sorted 💡 Key Learnings: ➡️ Improved logical thinking ➡️ Better understanding of loops & conditions ➡️ Hands-on with list operations and real-world scenarios ⚡ Faced small errors while coding, but debugging helped me learn deeper — that’s where real growth happens! 🔥 Consistency is building confidence day by day Global Quest Technologies ✨ #100DaysOfCode #Python #PythonProgramming #CodingJourney #LearnPython #ProblemSolving #Developer #CodingLife #TechSkills #SoftwareDevelopment #Debugging #GrowthMindset #GlobalQuestTechnologies #GQT #Day3Challenge
To view or add a comment, sign in
-
Hi guys, I know it’s delayed—now let’s dig into Python again for this post! 💭 Day 3 with Python… something finally clicked. The errors didn’t stop. The confusion didn’t magically disappear. But today… I wrote something that actually worked. Not just print("Hello, World!") Not just fixing errors… 👉 I made decisions in my code. Using if...else, my program could finally think (at least a little 😄) “IF this happens → do this” “ELSE → do something else” And suddenly, coding didn’t feel like typing… It felt like logic coming to life. 💡 That’s when I realized: Programming isn’t about memorizing syntax. It’s about teaching a machine how to think step by step. Every small concept—conditions, loops, functions— They’re not just topics… They’re building blocks of something bigger. Today it’s simple decisions. Tomorrow? Maybe something powerful. ✨ Step by step… line by line… growth is happening. #Python #CodingJourney #Day3 #LearnToCode #Programming #DeveloperLife #LogicBuilding #TechGrowth 🚀
To view or add a comment, sign in
-
🚀 Day 12 – Exception Handling in Python Today I learned how to handle errors without crashing the program. 🔹 What is an Exception? An exception is a runtime error that disrupts the normal flow of a program. 🔹 Why Exception Handling? ✔ Prevents program crashes ✔ Handles errors gracefully ✔ Improves program reliability 🔹 Basic Syntax: try: # risky code except: # handling code 🔹 Example: try: num = int(input("Enter number: ")) print(10 / num) except: print("Error occurred") 🔹 Handling Specific Errors: try: x = int(input()) print(10 / x) except ZeroDivisionError: print("Cannot divide by zero") except ValueError: print("Enter valid number") 🔹 try - except - else: try: x = int(input()) y = int(input()) print(x / y) except ZeroDivisionError: print("Error") else: print("Success") 🔹 finally Block: Used to execute important code (like closing files), whether error occurs or not. 🔹 Nested Exception Handling: Handling exceptions inside another try block. 💡 Key Learning: Good developers don’t avoid errors… they handle them smartly. Ajay Miryala 10000 Coders #Python #ExceptionHandling #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 50 of my #100DaysOfCode (Python Journey) Being disciplined is crucial to achieve your goals and this journey of 100 days 100 codes of python is about consistency and improving problem solving skills. Halfway through, and this journey has been more about discipline than motivation. Here’s what I’ve worked on so far: 🔹 Strengthened Python fundamentals (loops, functions, problem-solving) 🔹 Practiced Data Structures & Algorithms • Arrays, Lists, Dictionaries • Recursion • Trees (like checking if two trees are identical) 🔹 Learned and implemented OOP concepts • Classes & Objects • Inheritance & Polymorphism 🔹 Solved coding problems consistently to improve logic - Learnings: It’s not about doing something huge every day — it’s about showing up daily, even when you don’t feel like it. Consistency is the key. Still 50 days to go. Next focus: ➡️ More advanced DSA ➡️ Building small real-world projects ➡️ Improving problem-solving speed Let’s finish strong Git-hub :- https://lnkd.in/dDUiHCtj #Python #100DaysOfCode #CodingJourney #DSA #LearningInPublic
To view or add a comment, sign in
-
-
In my previous post, i talked about breaking code with one small change. This time? It gets worse. You write the code. 1 error. You fix the error. 12 new errors. And your screen is basically on fire. Every programmer has been here. Every single one. Here is the truth about errors in coding: Errors are not failure. They are feedback. Python does not hate you. It is telling you exactly what is wrong. Fixing one error exposing others means you are making progress. The code was always broken. Now you can finally see it. How to handle cascading errors like a professional: Fix from the top. The first error often causes all the others. Read the full error message. The answer is always in there. Do not fix everything at once. One error at a time. Take a break. Fresh eyes fix bugs faster than tired ones. Note: Debugging is not the obstacle. It is the job. #Python #Debugging #DataScience #LearnToCode #BeginnerCoder #Coding #StudentLife
To view or add a comment, sign in
-
More from this author
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development