🚀 Day 39 / 180 – DSA with Java 🚀 📘 Topic Covered: Math & Simulation 🧩 Problem Solved: Count Operations to Obtain Zero Problem: Given two integers, repeatedly subtract the smaller number from the larger one until one of them becomes zero. Return the number of operations performed. Approach: Simulated the process by comparing both numbers and subtracting the smaller from the larger in each step, counting the number of operations until one becomes zero. Key Learning: ✔️ Understanding simulation-based problem solving ✔️ Applying basic math logic efficiently ✔️ Breaking problems into simple iterative steps If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #ProblemSolving #Consistency
Java DSA Day 39: Count Operations to Zero
More Relevant Posts
-
🚀 Day 41 / 180 – DSA with Java 🚀 📘 Topic Covered: Matrices & Marking Technique 🧩 Problem Solved: Set Matrix Zeroes Problem: Given a matrix, if an element is 0, set its entire row and column to 0. Approach: Used two auxiliary arrays to mark rows and columns that contain zeroes. In a second pass, updated the matrix by setting elements to zero based on the marked rows and columns. Key Learning: ✔️ Handling matrix-based transformations ✔️ Using extra space for clarity and simplicity ✔️ Breaking the problem into marking and updating phases If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Arrays #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 38 / 180 – DSA with Java 🚀 📘 Topic Covered: Strings & Two-Pointer Technique 🧩 Problem Solved: Is Subsequence Problem: Given two strings s and t, check whether s is a subsequence of t. Approach: Used two pointers to traverse both strings. Moved the pointer in s only when characters matched, and always moved the pointer in t, ensuring order is maintained. Key Learning: ✔️ Applying two-pointer technique on strings ✔️ Understanding subsequence vs substring ✔️ Writing clean and efficient O(n) solutions If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Strings #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 100 Days Java + DSA Challenge | Day 2 Today’s focus was on strengthening my programming fundamentals by covering: 🔹 Operators in Java (Arithmetic, Relational, Logical, Assignment) 🔹 Conditional Statements (if, if-else, nested if, switch) Understanding how operators work and how decisions are made in code is essential for building strong logic. These concepts are the backbone of problem-solving in Data Structures and Algorithms. 💡 Practiced writing multiple programs using conditions and improved my logical thinking step by step. Consistency is the key — small progress every day leads to big results. #100DaysOfCode #Java #DSA #LearningJourney #Coding #SoftwareDevelopment
To view or add a comment, sign in
-
🚀 Day 46 / 180 – DSA with Java 🚀 📘 Topic Covered: Matrix Manipulation 🧩 Problem Solved: Rotate Image Problem: Given an n x n matrix representing an image, rotate it 90 degrees clockwise in-place. Approach: First transposed the matrix by swapping rows and columns across the diagonal. Then reversed each row to complete the 90-degree clockwise rotation efficiently without extra space. Key Learning: ✔️ Breaking matrix problems into smaller transformations ✔️ Understanding transpose operations ✔️ Solving in-place matrix rotation with O(1) extra space If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Matrix #ProblemSolving #Consistency 💙
To view or add a comment, sign in
-
-
🚀 Day 44 / 180 – DSA with Java 🚀 📘 Topic Covered: Binary Search on Answer 🧩 Problem Solved: Koko Eating Bananas Problem: Given banana piles and limited hours, find the minimum eating speed required to finish all piles within the given time. Approach: Applied Binary Search on the possible eating speed range. For each speed, calculated total hours needed and adjusted the search space until finding the minimum valid speed. Key Learning: ✔️ Understanding binary search beyond arrays ✔️ Applying search on answer space efficiently ✔️ Solving optimization problems in O(n log m) time If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #BinarySearch #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 40 / 180 – DSA with Java 🚀 📘 Topic Covered: Binary Exponentiation (Fast Power) 🧩 Problem Solved: Pow(x, n) Problem: Implement a function to calculate x raised to the power n, handling both positive and negative values of n. Approach: Used Binary Exponentiation to reduce time complexity. Repeatedly squared the base and halved the exponent, multiplying the result only when needed. Also handled negative powers by taking the reciprocal. Key Learning: ✔️ Optimizing from O(n) to O(log n) ✔️ Understanding divide-and-conquer in exponentiation ✔️ Handling edge cases like negative powers If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 47 / 180 – DSA with Java 🚀 📘 Topic Covered: Matrix Traversal 🧩 Problem Solved: Spiral Matrix Problem: Given a matrix, return all elements in spiral order starting from the top-left corner. Approach: Used four boundaries — top, bottom, left, and right. Traversed layer by layer in four directions (left to right, top to bottom, right to left, bottom to top) while shrinking the boundaries after each pass. Key Learning: ✔️ Managing boundaries in matrix traversal ✔️ Breaking complex movement into clear steps ✔️ Handling edge cases in rectangular matrices If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Matrix #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 37 / 180 – DSA with Java 🚀 📘 Topic Covered: Arrays & Two-Pointer Technique 🧩 Problem Solved: Squares of a Sorted Array Problem: Given a sorted array of integers (including negatives), return a new array of the squares of each number, also sorted in non-decreasing order. Approach: Used a two-pointer approach from both ends of the array. Compared squares of elements and filled the result array from the end to maintain sorted order efficiently. Key Learning: ✔️ Handling negative values in sorted arrays ✔️ Using two-pointer technique for optimal solutions ✔️ Avoiding extra sorting to achieve O(n) time complexity If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Arrays #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 36 / 180 – DSA with Java 🚀 📘 Topic Covered: Binary Search (Peak Finding) 🧩 Problem Solved: Find Peak Element Problem: Given an array, find a peak element (an element greater than its neighbors) and return its index. Approach: Used Binary Search by comparing the middle element with its neighbors. Based on the increasing or decreasing slope, moved towards the side where a peak must exist, reducing the search space efficiently. Key Learning: ✔️ Applying binary search on unsorted arrays using patterns ✔️ Understanding how slope direction guides decisions ✔️ Solving peak problems in O(log n) time If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #BinarySearch #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 7/100 – DSA Journey Today’s focus was on implementing a classic and important problem in number theory — Armstrong Numbers — using Java. 🔍 What I built: A program to find all Armstrong numbers within a given range (100 to 2000). 💡 Approach Breakdown: Iterated through each number in the range Counted the number of digits Extracted each digit and computed its power using Math.pow() Summed the results and compared with the original number Printed the number if it satisfies the Armstrong condition ⚙️ Key Concepts Used: Loops (while, for) Mathematical logic (digit extraction, power calculation) Function design for reusability Clean iteration over a range 📌 Output Observed: 153, 370, 371, 407, 1634 📈 Learning Insight: This problem strengthened my understanding of number manipulation and algorithmic thinking, which are fundamental in DSA and frequently asked in interviews. 🔥 Consistency is the key — building problem-solving skills step by step! #Day7 #100DaysOfCode #DSA #Java #ProblemSolving #CodingJourney #SoftwareDevelopment #LearnInPublic 🙌 Tagging: 10000 Coders Pathulothu Navinder
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