Day 53 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find the Missing and Repeating Number in an array. This is a classic mathematical + array problem and frequently asked in coding interviews. What the program does: • Takes an array of size n containing numbers from 1 to n • One number is missing and one is repeating • Uses mathematical formulas to find both efficiently • Returns: Missing number Repeating number Example Input: [3, 1, 2, 5, 3] Output: Missing = 4 Repeating = 3 How the logic works: Use formulas: 👉 Sum of first n numbers S = n(n+1)/2 👉 Sum of squares P = n(n+1)(2n+1)/6 Then: • Find difference of sums • Find difference of squares • Solve equations to get missing & repeating numbers Why this is important: – Combines math + arrays + logic – Optimized solution (no brute force) – Common in interviews (Amazon, Google basics) – Improves analytical thinking Time Complexity: O(n) Space Complexity: O(1) Key learnings from Day 53: – Using mathematical formulas in coding – Avoiding brute-force approaches – Solving equations programmatically – Writing optimized solutions #100DaysOfCode #Day53 #Python #PythonProgramming #Arrays #DSA #Algorithms #ProblemSolving #CodingPractice #InterviewPrep #Optimization #LogicBuilding #DeveloperJourney #Consistency #BTech #CSE #AIandML #VITBhopal #TechJourney
Python Array Problem: Missing & Repeating Number
More Relevant Posts
-
Small win, big step 🚀 I’ve just completed the “Python for Data Science, AI & Development” course on Coursera—and honestly, it feels like unlocking a new toolkit 🧠 From writing my first clean Python scripts to working with real data using libraries like NumPy and pandas, this journey has been more than just theory—it’s been hands-on, practical, and eye-opening. Key takeaways: • Python fundamentals and problem-solving • Working with libraries like NumPy and pandas • Data handling, file operations, and APIs • Introduction to data science concepts As someone from a finance background, I can clearly see how these skills will help me move towards data analytics and data-driven decision making. This is just the beginning—next step: building real-world projects and going deeper into data science 📊 Have you started your Python or data journey yet? Would love to hear your experience 👇 https://lnkd.in/g8xBAE8X #Coursera #Python #DataScience #LearningJourney #Upskilling #Analytics #CareerGrowth
To view or add a comment, sign in
-
If you want to start your AI learning journey, Python is the only place to begin. Intro to Python — Course Notes by Martin Ganchev (365 Data Science) is one of the most no-nonsense resources for absolute beginners who want to skip the confusion and go straight to writing real code. Here's why it stands out: ▶️ Covers Python from zero — variables, data types, operators, and syntax all explained cleanly in one place. ▶️ Logic-first approach — conditional statements, functions, and loops taught the way your brain actually understands them. ▶️ Sequences done right — Lists, Tuples, Dictionaries, and slicing — the building blocks every data professional uses daily. ▶️ Ends where it matters — iteration, combining loops and conditions, so you leave ready to write actual programs. Python is still the #1 language for data science and AI. And this is where most people should start. Pdf credit goes to respective owner. Follow me Pratham Uday Chandratre for practical AI and engineering resources. Repost so more builders find this.
To view or add a comment, sign in
-
Practice on files like .csv and .json to meet real world requirments. Now I am trying to move from basic Python to working with real data Most of my learning so far was focused on syntax, loops, and small programs. But recently, I wanted to try something closer to how data is actually handled. So I used NumPy to read a CSV file and generate a simple class report. What this does: • Reads data directly from a CSV file • Calculates average, highest, and lowest marks • Separates pass/fail students using conditions • Computes overall pass percentage 💡 What I learned from this: – Working with real data feels completely different from basic coding – NumPy makes data handling much more efficient – Structuring code properly (functions, error handling) matters a lot This is a small step, but it feels like I’m finally moving toward Data Science and Machine Learning in a practical way. Still learning. Still building. #Python #NumPy #DataAnalysis #MachineLearning #LearningInPublic #InternshipJourney #datascience
To view or add a comment, sign in
-
-
Master the Pythonic Way: DSA Basics Ready to level up your Data Structures and Algorithms (DSA) game? Doing DSA in Python isn’t just about getting the right output; it’s about writing clean, efficient, and Pythonic code. 🚀 If you’re still using 5 lines of code for a simple filter or a basic if-else block, it’s time for an upgrade. Today, I’m diving into two essential tools that make your algorithms sleeker: List Comprehensions and Ternary Operators. 1. List Comprehensions: The One-Liner Powerhouse Why write a for loop when you can generate a list in a single, readable line? It’s faster and keeps your workspace clutter-free. 2. Ternary Operators: Logic at a Glance When your algorithm needs a quick decision, ternary operators (conditional expressions) are your best friend. They are perfect for assigning values based on a condition without breaking the flow. The Syntax: value_if_true if condition else value_if_false 💡 Why this matters for DSA: Readability: Interviewers love code that is easy to follow. Efficiency: List comprehensions are often slightly faster than manual append() calls. Focus: It allows you to focus on the logic of the algorithm rather than the boilerplate of the syntax. What’s your favorite Python trick for competitive programming? Let’s discuss in the comments! 👇 #Python #DataStructures #Algorithms #Coding #SoftwareEngineering #Pythonic #ProgrammingTips
To view or add a comment, sign in
-
Want to boost your coding productivity? Mastering data manipulation in Python is the perfect place to start. Here is a comprehensive Pandas cheatsheet to help you streamline your data science workflows. Whether you are cleaning complex datasets, performing exploratory data analysis, or preparing data for machine learning models, having the exact commands you need right at your fingertips will save you hours of searching. Stop getting lost in documentation and start building faster. Save this post for your next project, share it with a colleague who might find it helpful, and let me know in the comments which Pandas function is your absolute favorite. Make sure to follow us for more insights on Python, data engineering, and artificial intelligence. #Python #Pandas #DataScience #DataAnalytics #MachineLearning #Coding #Productivity
To view or add a comment, sign in
-
In my journey of learning data analytics, I explored NumPy, one of the most powerful libraries in Python for numerical computing. NumPy makes it easy to work with arrays, mathematical operations, and large datasets efficiently. Its speed and performance make it a core foundation for libraries like Pandas and many machine learning frameworks. 🔹 What I learned: Creating and manipulating multi-dimensional arrays Performing fast mathematical & statistical operations Understanding vectorization for better performance Working with reshaping and indexing techniques 💡 Key Takeaway: NumPy significantly improves performance compared to traditional Python loops and is essential for anyone stepping into Data Science or Data Analytics. Every strong data project starts with efficient data handling — and NumPy makes that possible. 📊 Excited to keep learning and building more projects in Python! #Python #NumPy #DataScience #DataAnalytics #MachineLearning #AI #Programming #Coding #TechJourney #LearnInPublic #100DaysOfCode #DataDriven #Analytics #CareerGrowth 10000 Coders Aravala Vishnu Vardhan Manivardhan Jakka
To view or add a comment, sign in
-
-
🚀 Most beginners make this mistake in Data Science… They jump into Machine Learning without mastering the most important foundation: Python. Why Python matters? Python is not just a programming language — it is the foundation of modern Data Science workflows. * Simple and readable syntax * Powerful data science libraries * Industry standard across companies Core libraries you will use: * NumPy → numerical computing * Pandas → data analysis * Matplotlib / Seaborn → visualization * Scikit-learn → machine learning Simple example: data = [10, 20, 30, 40] avg = sum(data) / len(data) print(avg) Where Python is used: * Data analysis * Machine learning models * Recommendation systems * AI-based applications Key insight: In Data Science, tools do not make you powerful. Your understanding of how to use them does. Python just makes that journey smoother. #DataScience #Python #MachineLearning #AI #LearningInPublic
To view or add a comment, sign in
-
-
Python Series – Day 20: NumPy (Powerful Arrays for Fast Computing!) Yesterday, we learned Polymorphism 🎭 Today, let’s enter the world of Data Science with one of the most powerful Python libraries: 👉 NumPy 🧠 What is NumPy? 👉 NumPy stands for Numerical Python It is used for: ✔️ Fast calculations ✔️ Working with arrays ✔️ Mathematical operations ✔️ Data Science / Machine Learning Why Not Use Normal Lists? Python lists are useful, but NumPy arrays are: ⚡ Faster ⚡ Less memory usage ⚡ Better for large data 💻 Example 1: Create Array import numpy as np arr = np.array([1, 2, 3, 4]) print(arr) Output: [1 2 3 4] 💻 Example 2: Multiply All Values arr = np.array([1, 2, 3, 4]) print(arr * 2) Output: [2 4 6 8] 💻 Example 3: Mean of Data arr = np.array([10, 20, 30, 40]) print(arr.mean()) 🔍 Output: 25.0 Why NumPy is Important? ✔️ Used in Pandas ✔️ Used in Machine Learning ✔️ Used in Deep Learning ✔️ Industry standard for numeric data ⚠️ Pro Tip 👉 If you want Data Science, learn NumPy strongly 🔥 One-Line Summary 👉 NumPy = Fast arrays + powerful calculations Tomorrow: Pandas (Handle Data Like a Pro!) Follow me to master Python step-by-step 🚀 #Python #NumPy #DataScience #Coding #Programming #MachineLearning #LearnPython #Tech #MustaqeemSiddiqui
To view or add a comment, sign in
-
-
Innomatics Research Labs When I started learning Data Science, NumPy felt confusing—just arrays and numbers without real meaning. But as I explored deeper, I realized how powerful it is in handling data efficiently and performing complex operations with minimal code. In this article, I’ve shared my journey of understanding NumPy step by step—from basic concepts like arrays and vectorization to applying them in a real-world case study on student marks analysis. This hands-on approach helped me connect theory with practical applications and made learning much more meaningful. If you're starting with NumPy or struggling to understand how it actually works, this article might give you the clarity you need! I would love to hear your thoughts and feedback Grateful to my trainer Lohith Papakollu and mentor Sri Sai Tejaswini Pamula for their constant guidance and support. Special thanks to: Raghu Ram Aduri Kanav Bansal Kalpana Katiki Reddy Vishwanath Nyathani Sigilipelli Yeshwanth Nagaraju Ekkirala Tasleema Noor #Innomatics_Research_Labs_DLNR #InnomaticsResearchLabs #DataScience #LearningJourney #CareerGrowth #NumPy #Python #Programming #Coding #Learning #Developers #BeginnerFriendly
To view or add a comment, sign in
-
Python Basics Every Al Engineer Must Know If you're starting your Al journey, Python is your best friend Here's what I learned that actually matters 1. Variables & Data Types →int, float, string, boolean → These are the building blocks of every ML model 2. Lists & Dictionaries → Store datasets, features, and labels → df['column'] is just a dictionary in disguise! 3. Loops & Conditions → for loops to iterate over data →if/else to filter and clean data 4. Functions →Write reusable code for preprocessing. →def preprocess(df): your best habit 5. Libraries You Must Know →NumPy - numbers & arrays →Pandas - data manipulation →Matplotlib/Seaborn - visualization →Scikit-learn - ML models 6. OOP (Object Oriented Programming) →Classes & objects power every Al framework → TensorFlow, PyTorch are all built on OOP 7. File Handling →Read CSV. JSON. Excel files → pd.read_csv() is your daily driver. #Python #AIEngineering #MachineLearning #DataScience #Python4Al #LearnPython #AlBeginners
To view or add a comment, sign in
-
Explore related topics
- Approaches to Array Problem Solving for Coding Interviews
- Common Algorithms for Coding Interviews
- Problem Solving Techniques for Developers
- Common Coding Interview Mistakes to Avoid
- Prioritizing Problem-Solving Skills in Coding Interviews
- Strategies for Solving Algorithmic Problems
- Build Problem-Solving Skills With Daily Coding
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