🚀 Day 14/30 – Search Insert Position (Binary Search in Python) Today’s problem: LeetCode 35 – Search Insert Position We’re given: A sorted array of distinct integers A target value If the target exists → return its index. If not → return the index where it should be inserted.SoarX Constraint: O(log n) runtimeConsistency > Motivation 💪 #30DaysOfCode #BinarySearch #python #DSA #Algorithms #CodingChallenge #LeetCode
Binary Search in Python: LeetCode 35 Solution
More Relevant Posts
-
🚀Day 12 -Ord() and chr() in python In Python, the ord() and chr() functions are used to convert characters to their Unicode values and vice versa. The ord() function returns the Unicode (ASCII) value of a character. The chr() function returns the character from a Unicode value. #Python #LearnPython #PythonProgramming #CodingBasics #DataScience #ProgrammingJourney
To view or add a comment, sign in
-
-
🚀 Day 18 – range() in Python Today I explored the range() function in Python. print(list(range(5))) 🔹 range() is used to generate a sequence of numbers. 🔹 Mostly used with loops. 🔹 range(5) generates numbers from 0 to 4. Simple function, but very powerful when working with loops and iterations. #Python #PythonLearning #PythonLoops #30DaysOfCode #CodingJourney
To view or add a comment, sign in
-
-
🤜 Python Challenge #2 – Answer Revealed! b = a does not create a new list. It simply makes b reference the same list object in memory as a. When we do: a += [4] Python modifies the list in-place instead of creating a new one. Since both a and b point to the same list, the change appears in both variables. #Python #PythonLearning #CodingChallenge #100DaysOfCode #LearnPython
To view or add a comment, sign in
-
-
Null values are the bane of many analysts' existence (myself included). In order to fix them, you need to find them first. Here are a couple ways to do that. There are several methods in pandas which can drop, replace, and change null values to more useful values. For any custom logic, however, you need to detect the nulls and then write code to handle them however you need. When is the last time you needed a custom solution for null handling? #dataanalyst #datascientist #dataengineer #python
To view or add a comment, sign in
-
-
🚀 Solved the First Bad Version problem using Binary Search in Python. Instead of checking every version sequentially, Binary Search helps reduce the number of checks from O(n) to O(log n) — making the solution highly efficient. Key idea: • If the middle version is bad → search the left side • If the middle version is good → search the right side This pattern is widely used in problems involving first occurrence, boundaries, and optimization. Always fascinating to see how a simple algorithm like Binary Search can solve real-world style problems so efficiently. #Python #BinarySearch #Algorithms #LeetCode #CodingJourney #SoftwareDevelopment
To view or add a comment, sign in
-
-
LeetCode #104 – Maximum Depth of Binary Tree | Python Implementation I implemented a recursive DFS approach that calculates tree depth by taking the maximum of left and right subtree depths plus one for the current node. Core Insight: Depth calculation decomposes naturally into subproblems. Each node's depth is determined by its deepest child, making recursion the cleanest solution with minimal code. Time: O(n) | Space: O(h) where h = tree height (recursion stack) #LeetCode #DataStructures #Python #BinaryTree #Recursion #DFS #CodingInterview #SoftwareEngineering
To view or add a comment, sign in
-
-
A quick #map #visualization in #Python cheat sheet on - and if you want to learn all of these (and a lot) more in Python, then: 𝐆𝐞𝐨𝐬𝐩𝐚𝐭𝐢𝐚𝐥 𝐃𝐚𝐭𝐚 𝐒𝐜𝐢𝐞𝐧𝐜𝐞 𝐄𝐬𝐬𝐞𝐧𝐭𝐢𝐚𝐥𝐬 - 𝐒𝐞𝐜𝐨𝐧𝐝 𝐄𝐝𝐢𝐭𝐢𝐨𝐧 The book: https://lnkd.in/dy-7m_zz Sample: https://lnkd.in/dVP-Ty-Y Reviews: https://lnkd.in/dMii-cxX Overview: https://lnkd.in/d5anyYAU
To view or add a comment, sign in
-
-
📌Python Sets – Accessing Set Items I learned how to access elements in a Python set using a loop. Since sets are unordered, we cannot access items using an index. Instead, we use a for loop to iterate through each element. ✅ Sets do not support indexing ✅ Items are accessed using loops ✅ Order of output may change ✅ Duplicate values are automatically removed #Python #DataAnalytics #LearningJourney #PythonSets #CodingPractice #Upskilling
To view or add a comment, sign in
-
-
When exploring a new dataset in Python, one simple command can save a lot of time: df.describe() It quickly shows key statistics for numerical columns — count, mean, standard deviation, min, max, and quartiles. Instead of manually checking distributions, this gives an instant snapshot of the data and often helps spot outliers or unusual values early in the analysis. Small habits like this make the data exploration phase much faster. #Python #DataAnalytics #MachineLearning #DataScience
To view or add a comment, sign in
-
Solved the Largest Number from Array problem using a greedy approach with custom sorting in Python. Key insight: compare a+b vs b+a instead of normal numeric sorting. Time Complexity: O(n log n). Strengthening my understanding of comparators, string manipulation, and algorithmic thinking through consistent practice. #geekstreak60 #npci #DSA #Python #ProblemSolving #GreedyAlgorithm #CodingPractice #AlgorithmicThinking
To view or add a comment, sign in
-
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