𝐃𝐚𝐲 𝟓𝟖/𝟏𝟎𝟎 – Competitive Programming (CodeForces) Solved: 1485A – Add and Divide The idea was to keep increasing the divisor b and simulate the operations. Using log₂(constraints) as an upper bound for the loop keeps the number of iterations small and avoids TLE. Just checking a small range of possible values for b gives the optimal answer. #Codeforces #CompetitiveProgramming #100DaysOfCode #Math #Implementation #ProblemSolving #DSA #Cpp #Algorithms
CodeForces 1485A Solution: Optimizing Divisor Search
More Relevant Posts
-
𝐃𝐚𝐲 𝟖𝟎/𝟏𝟎𝟎 – Competitive Programming (CodeForces) • 2211A – Antimedian Deletion • 2211B – Mickey Mouse Constructive --A was about observing the pattern from sample testcases and applying it correctly. --B was a constructive problem, building the array using -1 and 1 based on conditions. #Codeforces #CompetitiveProgramming #100DaysOfCode #Constructive #Implementation #ProblemSolving #DSA #Cpp #Algorithms
To view or add a comment, sign in
-
-
Clean code starts with mastering the basics. In this small C++ example, I implemented two simple but important functions: • SumArray to calculate the total sum of array elements • ArrayAverage to compute the average using the sum function and proper type casting A good reminder that strong software engineering is built on clear logic, reusable functions, and well-documented code. GitHub: https://lnkd.in/dBFE-5U8 #cpp #programming #algorithms #softwareengineering #coding
To view or add a comment, sign in
-
-
𝐃𝐚𝐲 𝟔𝟕/𝟏𝟎𝟎 – Competitive Programming (Codeforces) Solved: B – Corner the Knight Interesting pattern observation problem. --If we look at the board diagonally, the knight moves form a pattern repeating every 3 positions. --The number of reachable points increases up to a midpoint and then decreases symmetrically. --Using this diagonal pattern, we can directly compute the number of feasible starting positions without simulation. #Codeforces #CompetitiveProgramming #100DaysOfCode #Math #Patterns #ProblemSolving #DSA #Cpp #Algorithms
To view or add a comment, sign in
-
-
🧩 LeetCode Challenge – Day 75 ✅ Today’s problem was a classic Dynamic Programming challenge focused on transforming one string into another. 🔗 LeetCode 72 – Edit Distance The goal is to compute the minimum number of operations needed to convert one string into another using insertions, deletions, or replacements. Defining the DP state as the cost to convert prefixes of the two strings makes the transitions systematic. 💡 Key Takeaways: • String transformation problems often rely on well-defined DP states • Breaking the problem into prefix comparisons simplifies reasoning • Understanding base cases is crucial for correct DP initialization #Day75 #LeetCodeChallenge #365DaysOfCode #DSA #CodingJourney #ProblemSolving #DynamicProgramming #Strings
To view or add a comment, sign in
-
-
Day 6 🚀 Solved: Maximum Depth of Binary Tree (LeetCode 104) This is a classic recursion problem on trees. 💡 Key idea: The depth of a tree is 1 + the maximum depth of its left and right subtrees. 🔹 Approach: If the node is null → depth is 0 Recursively calculate depth of left and right Take the maximum and add 1 ⏱️ Time Complexity: O(n) 🔗 GitHub: https://lnkd.in/gz5mBpDx #DSA #LeetCode #Coding
To view or add a comment, sign in
-
𝐃𝐚𝐲 𝟖𝟕/𝟏𝟎𝟎 – Competitive Programming (CodeForces) Contest: Codeforces Round 1090(Div. 4) --A was basic min(bounds,x+1) logic --B used sum and negation of elements with max element --C was constructing permutation for median (3*n) using two pointers where median is high-1. --D involved generating primes along the way and using them to build a permutation where GCD stays unique. --E was something using xor and bit manipulation but couldnt get it right. #Codeforces #CompetitiveProgramming #100DaysOfCode #Math #Greedy #NumberTheory #ProblemSolving #DSA #Cpp #Algorithms
To view or add a comment, sign in
-
-
DAY->7 Solved "Sort Array By Parity II" on LeetCode using the Two Pointer Approach in C++. -> Runtime: 0 ms (Beats 100%) -> Optimized time complexity: O(n) -> Practicing efficient array manipulation and pointer techniques. Consistency in Data Structures & Algorithms is the key to improving problem-solving skills. #LeetCode #DSA #Programming #Cpp #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 80/100 – LeetCode Daily Challenge 🧠 Problem: Concatenated Binary 📌 Difficulty: Medium Today’s challenge was to concatenate the binary representations of numbers from 1 to n and return the decimal value of the resulting binary string. 💡 Approach: Instead of actually forming the string, I used bit manipulation to simulate the concatenation: For each number i, compute its bit length using floor(log2(i)) + 1. Left shift the current result by that many bits and add i, applying modulo at each step to prevent overflow. This gives an efficient O(n) solution in both time and space. 📊 Result: ✅ 403 / 403 test cases passed ⚡ Runtime: competitive and clean This problem was a great reminder of how bitwise operations can elegantly solve problems that seem string-heavy at first glance. #LeetCode #CodingChallenge #100DaysOfCode #Day80 #Java #BitManipulation #ProblemSolving #Tech #Programming #DailyCoding #DevCommunity #WomenWhoCode #CodeNewbie
To view or add a comment, sign in
-
-
Day 54 of Practicing DSA (LeetCode && Competitive Programming) Today’s progress: LeetCode • Maximum Product Subarray – Medium Focused on: • Understanding Kadane’s Algorithm variation • Tracking both maximum and minimum product (due to negative numbers) • Handling sign changes effectively • Improving intuition for dynamic programming in arrays This problem deepened my understanding of how negative values impact subarray problems. Competitive Programming • Continued practicing problem-solving patterns Improved my thinking on: • Handling edge cases in array-based problems • Writing optimized solutions with better logic clarity Daily progress may look small, but it’s building strong fundamentals 💪 Consistency is the real game 🔥 #DSA #Java #LeetCode #Codeforces #DynamicProgramming #Arrays #ProblemSolving #Consistency #Learnin
To view or add a comment, sign in
-
-
#15 SOLID Principles: The 5 Rules Every Developer Should Know 👇🏾 SOLID principles are the backbone of clean, maintainable software design. Whether you're preparing for a technical interview or aiming to write better code, these five principles — introduced by Robert C. Martin — are essential to master. Let's break them down. #SOLID #CleanCode #SoftwareEngineering #CodingInterview #OOP #DesignPrinciples #Programming #SoftwareDevelopment #TechInterview #CodeQuality #BackendDevelopment #LearnToCode #SoftwareArchitecture #BestPractices
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