#Day13 – Advanced Strings & Mutable vs Immutable 🤯 Today was all about Advanced String concepts and understanding Mutable vs Immutable in Java. ✔ Difference between immutable and mutable strings ✔ How concat() creates a new object in Heap ✔ How reference update changes output ✔ Difference between String, StringBuffer, and StringBuilder ✔ Initial capacity (16) and dynamic capacity formula (n * 2 + 2) ✔ Methods like length(), charAt(), toCharArray() ✔ Split vs StringTokenizer (why split is recommended) TAP Academy Harshit T #Java #Strings #StringBuilder #StringBuffer #CoreJava #ProgrammingJourney #Consistency
Java Strings: Immutable vs Mutable Concepts
More Relevant Posts
-
Day 39 – Deep Dive into Java Strings ☕ Today I focused on revising and understanding Strings in Java in detail. Topics covered: 🔹 Types of Strings (String, StringBuilder, StringBuffer) 🔹 Immutable nature of Strings 🔹 Memory allocation (String Constant Pool vs Heap Area) 🔹 Different ways to compare Strings (==, equals(), equalsIgnoreCase(), compareTo()) 🔹 String concatenation using + vs concat() Understanding how strings are stored in memory and how comparisons work helped me gain deeper clarity on writing efficient and correct programs. #Day39 #JavaJourney #Strings #CoreJava #ProgrammingFundamentals #Consistency
To view or add a comment, sign in
-
🚀 Day 34/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 709. To Lower Case Used ASCII manipulation to convert uppercase letters to lowercase by adding 32, without using built-in functions. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) Strengthening understanding of character encoding and string manipulation basics. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 17 of #100DaysOfCode Solved the Concatenation of Consecutive Binary Numbers problem today using Bit Manipulation + Modulo Arithmetic in Java. Instead of converting numbers to binary strings, we shift the current result left by the number of bits in i and add i. We increase the bit count only when i is a power of 2 using: (i & (i - 1)) == 0 #Java #DSA #BitManipulation #LeetCode #CodingJourney #PlacementPrep
To view or add a comment, sign in
-
Day 86 - LeetCode Journey Solved LeetCode 19: Remove Nth Node From End of List in Java ✅ Classic linked list problem where the goal is to remove the n-th node from the end in one pass. Used the two-pointer (fast & slow) approach with a dummy node to handle edge cases smoothly. First, I moved the fast pointer n steps ahead, then moved both pointers together until fast reached the end. This way, the slow pointer lands exactly before the node to be deleted. Clean, efficient, and avoids multiple traversals. Key takeaways: • Strong use of two-pointer technique • Importance of dummy node for edge cases • One-pass optimal solution (O(n)) • Better understanding of linked list deletion ✅ All test cases passed ⚡ Optimized single traversal approach Linked list problems really test your pointer clarity 🔥 #LeetCode #DSA #Java #LinkedList #TwoPointers #ProblemSolving #CodingJourney #InterviewPrep #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
Day 3/50 | #50DaysOfCode 📍 Platform: LeetCode 💻 Language: Java ✅ 2520. Count the Digits That Divide a Number (Easy) Today’s problem focused on digit extraction and divisibility checks. It helped strengthen my understanding of number manipulation and conditional logic. 🔎 Approach: Extract each digit using modulus (%) Check if the digit divides the original number using modulo If divisible, increment the counter Continue until all digits are processed Return the final count 📌 Example: Input: num = 1248 Output: 4 Explanation: All digits (1, 2, 4, 8) divide 1248 evenly This problem improved my understanding of loops, digit handling, and divisibility logic in Java. #DSA #LeetCode #Java #CodingJourney #ProblemSolving #Consistency #LearningJourney #50DaysOfCode #LinkedIn
To view or add a comment, sign in
-
-
🚀 Day 73 / 100 Days of LeetCode Question: Check if Binary String Has at Most One Segment of Ones Given a binary string s, determine whether it contains at most one continuous segment of '1's. Solved in Java by checking whether the pattern "01" exists in the string. If "01" appears, it means a new segment of 1s starts after a 0, which violates the condition. This provides a clean and efficient solution. Consistency > perfection. Day 74 loading 🔥 #100DaysOfCode #LeetCode #Java #DSA #ProblemSolving
To view or add a comment, sign in
-
-
I used to think equals() and == in Java were basically the same. They’re not. == checks if two references point to the same memory location. equals() checks if two objects are logically equal. That difference looks small. Until your HashMap stops working properly. In Java, if you override equals(), you must also override hashCode(). Because collections like HashMap use hashCode() first to find the bucket, and then equals() to confirm the match. Forget one of them… and your object becomes “invisible” inside the map. One small contract. One big lesson. #Java #BackendDevelopment #SoftwareEngineering #Programming
To view or add a comment, sign in
-
Day 14/100 – LeetCode Challenge 🚀 Problem: #169 Majority Element Difficulty: Easy Language: Java Approach: Sorting + Middle Element Time Complexity: O(n log n) Space Complexity: O(1) 🔍 Key Insight: The majority element appears **more than ⌊n / 2⌋ times** in the array. If we **sort the array**, the majority element must occupy the **middle position** because it appears more than half of the time. Therefore, the element at index **n/2** will always be the majority element. 🧠 Solution Brief: First sorted the array using `Arrays.sort()`. Since the majority element appears more than half of the array length, it will always be positioned at the middle index. Finally returned `nums[nums.length / 2]` as the majority element. 📌 What I Learned: Understanding problem constraints can simplify the solution significantly. Sometimes a simple observation (like majority occupying the middle after sorting) can avoid more complex implementations. #LeetCode #Day14 #100DaysOfCode #Java #DSA #Arrays #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Leetcode Problem || Complement of Base 10 Integer(1009) 🚀 The Bitwise Complement problem using Java. 🔹 Idea: The complement of a number means flipping all bits in its binary representation (0 → 1 and 1 → 0). Instead of manually converting the number to binary, I used a bit manipulation trick: 1️⃣ Find the highest set bit using Integer.highestOneBit(n) 2️⃣ Create a mask with all bits set to 1 up to that position 3️⃣ Use XOR (^) with the mask to flip the bits #LeetCode #Java #BitManipulation #CodingPractice #ProblemSolving #SoftwareDevelopment
To view or add a comment, sign in
-
-
Day 94/100: #LeetCodeChallenge – Grid Partitioning in Java 🧩💻 Another day, another algorithmic deep dive! Today’s problem was about determining whether a grid can be partitioned in a specific way. While the problem may seem straightforward at first, the real challenge lies in handling edge cases, optimizing for efficiency, and ensuring clean, maintainable code. 🔍 Key takeaways from today’s solution: Understanding 2D array traversal and prefix sums Handling edge cases like 1x1 grids early Writing readable code that can scale with larger test cases Even though the sample output shows "You must run your code first," the process of thinking through the logic, testing edge cases, and refining the approach is where the real growth happens. Every problem adds another tool to the problem-solving toolkit. 🚀 Consistency > Intensity. Day 94 is in the books. On to the final sprint! #100DaysOfCode #LeetCode #Java #CodingChallenge #ProblemSolving#GridPartitioning #DataStructuresAndAlgorithms #TechJourney#SoftwareEngineering #CodeNewbie #DeveloperLife #AlgorithmDesign#ConsistencyIsKey
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