Solved: Count Number of Factors of N (DSA) Today I worked on a classic problem — finding the number of divisors of a number. 🔹 Started with a basic approach: O(N) 🔹 Optimized it to: O(√N) using divisor pairs 💡 Key Insight: Every divisor i has a corresponding pair N/i, which helps reduce the number of iterations significantly. Also handled the edge case of perfect squares carefully ✔️ This is a small problem, but it builds strong fundamentals for: Number Theory Competitive Programming Technical Interviews Would love feedback from the community 🙌 #DSA #Java #Coding #ProblemSolving #SoftwareEngineering #LearningInPublic
More Relevant Posts
-
DSA Practice Update Today I solved: #141 – Linked List Cycle Learned how to detect a cycle in a linked list using Floyd’s Cycle Detection Algorithm (fast and slow pointers). Understood how moving pointers at different speeds helps identify if a loop exists without using extra space. Key Learnings: • Fast and slow pointer technique • Detecting cycles efficiently in O(n) time • Solving problems with constant space complexity This problem strengthened my understanding of pointer-based approaches, which are commonly used in linked list interview questions. Continuing to stay consistent and improve problem-solving skills step by step. #DSA #LeetCode #CodingJourney #Java #SoftwareDevelopment #PlacementPreparation
To view or add a comment, sign in
-
-
DSA Practice Update Today I solved: #78 – Subsets Learned the backtracking approach to generate all possible subsets (power set). Understood how to explore both choices at each step: including or excluding an element, and how to use recursion with backtracking to build all combinations. Key Learnings: • Introduction to backtracking technique • Recursion with decision making (pick / not pick) • Building combinations step by step This problem helped me understand the fundamentals of backtracking, which is an important concept for many interview problems. Continuing to stay consistent and strengthen core concepts. #DSA #LeetCode #CodingJourney #Java #SoftwareDevelopment #PlacementPreparation
To view or add a comment, sign in
-
-
🚀 Day 25/100 Days of Code Challenge 🔥 Problem: Rotate String(Leetcode 796) We are given two strings s and goal. 👉 We need to check if we can rotate string s (move first character to last again and again) to make it equal to goal. 📌 Example: abcde → bcdea → cdeab → deabc → eabcd ⚙️ Approach Check if lengths of both strings are equal Concatenate string with itself → s + s Check if goal exists inside the new string ⏱️ Complexity Time Complexity: O(n) Space Complexity: O(n) 📚 What I Learned ✔️ Simple tricks can save time ✔️ Avoid unnecessary loops ✔️ Think smart, not hard 💪 Day by day improving 🚀 #100DaysOfCode #Coding #Java #DSA #LearningJourney
To view or add a comment, sign in
-
-
🚀 Day 57 of DSA Journey Solved Next Greater Element II (LeetCode 503) today — a solid problem on Monotonic Stack + Circular Array concepts. 🔍 Key Learnings: • How to use a monotonic decreasing stack efficiently • Handling circular arrays using 2*n traversal • Understanding when and why elements get resolved in stack-based problems 💡 Insight: This problem reinforced that many questions are just variations of the same core pattern. Once you truly understand the pattern, solving similar problems becomes much more intuitive. 📈 Progress > Perfection. Staying consistent and focusing on building strong fundamentals. #DSA #LeetCode #Java #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
DSA Practice Update Today I solved: #876 – Middle of the Linked List Learned how to efficiently find the middle node of a linked list using the fast and slow pointer approach. Understood how moving one pointer twice as fast as the other helps identify the middle element in a single traversal. Key Learnings: • Fast and slow pointer technique • Efficient traversal of linked lists • Solving problems in O(n) time with constant space This problem strengthened my understanding of pointer-based techniques, which are very useful in linked list problems. Continuing to stay consistent and improve problem-solving skills step by step. #DSA #LeetCode #CodingJourney #Java #SoftwareDevelopment #PlacementPreparation
To view or add a comment, sign in
-
-
Today I solved: Longest Consecutive Sequence 💡 Key Takeaway: Sorting seems like the obvious approach, but it’s not the most optimal. By using a HashSet, we can reduce the time complexity and achieve an O(n) solution. 👉 Approach: - Store all elements in a Set - Start sequence only when the previous number is not present - Count the length of consecutive numbers 📊 Time Complexity: O(n) 🔍 What I learned: Sometimes the best solution comes from avoiding unnecessary work (like sorting) and thinking in terms of direct lookup using hashing. Optimizing the approach is as important as solving the problem 💪 #DSA #LeetCode #Java #CodingJourney #SoftwareEngineering
To view or add a comment, sign in
-
Solved today’s LeetCode Daily Challenge — 396. Rotate Function At first, the problem looked confusing because of array rotations and formulas 😅 But after understanding the pattern, it became much easier. What the problem says in simple words: We rotate the array again and again and calculate a value using: (index × element) Then we need to find the maximum value among all rotations. What I learned: How array rotation works Optimizing brute force using maths Using previous rotation result to calculate the next one efficiently Optimized Approach: Time Complexity: O(n) Space Complexity: O(1) Consistency + daily practice = improvement #LeetCode #DSA #Java #ProblemSolving #CodingJourney #DailyChallenge #LeetCodeDaily
To view or add a comment, sign in
-
-
🚀 Day 59 of #DSA 🔄 Switched to a new pattern: Sliding Window ✅ Solved: Longest Substring Without Repeating Characters (LeetCode 3) 💡 Key Insight: Maintain a window and adjust it dynamically — expand when characters are unique, shrink when duplicates appear. ⚙️ Approach: - Use two pointers (left & right) - Use a set to track characters - Update maximum length while traversing 📚 Key Learning: Efficient problems often come down to managing a window instead of checking all possibilities. New pattern, new learning 🚀 #Day59 #SlidingWindow #LeetCode #Java #DSA #CodingJourney #100DaysOfCode #Tech
To view or add a comment, sign in
-
-
#Day361 of #1001DaysOfCode 📘 LeetCode Daily Challenge Problem: XOR After Queries 💡 Approach: Simulated each query by updating elements in the array based on the given step and multiplier, and finally computed the XOR of all elements. This approach works correctly but can be further optimized for large inputs using better range update techniques. ⏱ Time Complexity: O(q * n) 🧠 Space Complexity: O(1) Learning to identify optimization opportunities in problems 🚀 #DSA #Java #LeetCode #ProblemSolving #Coding
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