🌱 Day 24 of #100DaysOfCode 🚀 📍 Day 24 Progress Solved problems based on array rotations: 📌Rotate an array from the right 📌Rotate an array in cyclic manner (clockwise) Worked on understanding how shifting elements impacts time complexity and how optimized approaches improve efficiency compared to brute force rotations. #100DaysOfCode #DSA #Arrays #Java #RevisionMode #LearningInPublic #Consistency
Day 24: Array Rotations in Java
More Relevant Posts
-
🚀 Day 47 of #100DaysOfCode 🌱 Topic: Arrays / HashMap ✅ Problem Solved: LeetCode 260 – Single Number III 🛠 Approach: Used a HashMap to track frequency of elements. Traversed the array and stored counts of each number. Iterated through the map to find elements with frequency 1. Stored those elements in the result array. This approach is straightforward but uses extra space. #100DaysOfCode #Day47 #DSA #Arrays #HashMap #BitManipulation #LeetCode #Java #ProblemSolving #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 56 - Search a 2D Matrix Approached the problem by leveraging the sorted property of the matrix. Applied binary search over virtual 1D space instead of traversing row-wise. Time Complexity: O(log(m*n)) #Day56 #LeetCode #Java #BinarySearch #Matrix #DSA #CodingPractice #ProblemSolving
To view or add a comment, sign in
-
-
🚀 LeetCode #61 – Rotate List Solved this problem by optimizing the rotation process instead of performing repeated shifts. Calculated the list length, reduced unnecessary rotations using k % length, and applied pointer manipulation to rotate the list efficiently. ✅ Time Complexity: O(n) ✅ Space Complexity: O(1) Another step forward in improving my understanding of Linked List operations. #LeetCode #DataStructures #Java #LinkedList #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 28/50 — LeetCode #1768: Merge Strings Alternately Another day, another clean problem solved ✅ 💡 Approach: Used a single pointer to traverse both strings and alternately append characters. If one string is longer, just continue with the remaining characters. 🔧 Highlights: Used StringBuilder for efficient string manipulation Simple loop with boundary checks No extra complexity — just clean logic ⚡ Complexity: Time: O(n + m) Space: O(n + m) 📌 Takeaway: Problems like this remind me that clarity beats over-engineering. The simplest approach is often the best one. Consistency is the real win here — showing up every day and improving bit by bit. #Day28 #LeetCode #Java #DSA #CodingJourney #50DaysOfCode
To view or add a comment, sign in
-
-
Day 52 of #100DaysOfLeetCode 🚀 Solved Balanced Binary Tree (Easy) 🌳 Learned how to efficiently check if a binary tree is height-balanced using a single DFS traversal. Instead of recalculating heights multiple times (O(n²)), optimized it to O(n) by combining height calculation with balance checking. 💡 Key takeaway: Return -1 early when imbalance is detected to avoid unnecessary computations. #LeetCode #DSA #Java #CodingJourney
To view or add a comment, sign in
-
-
Most problems aren’t about brute force. They’re about recognizing patterns. Today’s focus: Day 48/100 – Sliding Window Mastery 🚀(Longest Subarray with At Most 2 Distinct Elements) Instead of checking every possible subarray (O(n²)), I used the Sliding Window + HashMap approach to optimize it to O(n) time complexity. 🔹 Expand the window using r 🔹 Track frequencies using HashMap 🔹 Shrink from l when distinct elements exceed 2 🔹 Update maximum length dynamically Clean. Efficient. Scalable. Consistent practice is making pattern recognition faster and more intuitive every day. #Day48 #100DaysOfCode #DSA #Java #CodingJourney #SlidingWindow #ProblemSolving #LeetCode
To view or add a comment, sign in
-
-
Day 35 – Plus One Worked on a problem where a large integer is represented as an array of digits, and the task was to increment the number by one. Key Learnings: Traversing arrays from right to left to simulate digit addition Handling carry when a digit becomes 10 Managing edge cases where all digits are 9 by creating a new array #DSA #Java #Arrays #ProblemSolving #CodingPractice #LeetCode
To view or add a comment, sign in
-
-
Day 14/100 – LeetCode Challenge Problem: Linked List Cycle II Today’s problem focused on detecting the node where a cycle begins in a linked list. Approach: Used Floyd’s Cycle Detection Algorithm (Slow & Fast pointers). Move slow by one step and fast by two steps. If they meet, a cycle exists. Reset slow to head. Move both slow and fast one step at a time. The node where they meet again is the starting node of the cycle. Complexity: Time: O(n) Space: O(1) Concepts Practiced: Linked List traversal Floyd’s cycle detection Pointer manipulation #100DaysOfCode #LeetCode #DSA #Java #LinkedList #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Day 16/100 – LeetCode Challenge Problem: Merge Sorted Array Today’s problem involved merging two sorted arrays into one sorted array. Approach: Created a temporary array of size m + n Used two pointers to compare elements from both arrays Inserted the smaller element into the new array Copied remaining elements if any array still had values Finally copied the merged result back into nums1 Complexity: Time: O(m + n) Space: O(m + n) Concepts Practiced: Two-pointer technique Array traversal Merging sorted arrays #100DaysOfCode #LeetCode #DSA #Java #Arrays #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 42 of #100DaysOfCode 🌱 Topic: Linked List / Two Pointers ✅ Problem Solved: LeetCode 82 – Remove Duplicates from Sorted List II 🛠 Approach: Used a dummy node to simplify handling edge cases where the head might be removed. When two consecutive nodes had the same value, stored that value. Skipped all nodes with that duplicate value using a loop. Linked the previous node to the next distinct node. Continued traversal until reaching the end. This ensures that only unique elements remain in the sorted list. #100DaysOfCode #Day42 #DSA #LinkedList #TwoPointers #LeetCode #Java #ProblemSolving #CodingJourney #Consistency
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