Day :02 #Java #Coding #Anagram #Strings 👉 Question: Write a program to check whether two given strings are anagrams of each other. ✅ Example 1: Input: s1 = "RACE", s2 = "CARE" Output: This Is Anagram ❌ Example 2: Input: s1 = "hello", s2 = "world" Output: This Is Not Anagram ✅ Example 3: Input: s1 = "listen", s2 = "silent" Output: This Is Anagram
More Relevant Posts
-
->A simple Java concept that’s easy to overlook 👇 Immutable Strings 🔒 String str = "hello"; str.concat(" world"); System.out.println(str); // still "hello" Strings don’t change after creation. Operations like concat() create a new object instead ♻️ str=str.concat(" world"); System.out.println(str); // "hello world" Small detail ⚡ But important while writing logic 🧠 #Java #BackendDevelopment #Programming
To view or add a comment, sign in
-
🔥 1. String Coding Questions (Very Frequently Asked) 1. Reverse a string without using StringBuilder. 2. Check if a string is a palindrome. 3. Find the first non-repeating character in a string. 4. Find duplicate characters in a string. 5. Remove duplicate characters from a string. 6. Check if two strings are anagrams. 7. Count vowels and consonants in a string. 8. Find the longest substring without repeating characters. 9. Find the longest palindrome substring. 10. Reverse words in a sentence #java #java8 #frequentlyaskquerions
To view or add a comment, sign in
-
Last post we discussed why String is immutable in Java. So what if you need to modify strings frequently? 🤔 That’s where StringBuilder and StringBuffer come in. Both are mutable, but choosing the right one matters. 👉 StringBuilder = faster for single-threaded use 👉 StringBuffer = thread-safe for shared multithreaded use Swipe → to understand the real difference. 💬 Comment “code” for more Java examples. #Java #Backend #JavaDeveloper #Programming #InterviewPrep #StringBuilder
To view or add a comment, sign in
-
Day 45-What I Learned In a Day (JAVA) Today I explored some important concepts related to static in Java: 🔹 Static Method Learned how static methods belong to the class and can be called without creating an object. 🔹 Static Initializer (Static Block) Understood how a static block is executed only once when the class is loaded. 🔹 Single-Line Static Initializer Explored how we can initialize static variables in a single line. 🔹 Multi-Line Static Initializer Learned how to use static blocks for complex initialization logic. Practiced 👇 #Java #Programming #LearningJourney #Coding #100DaysOfCode
To view or add a comment, sign in
-
🚨 Java fact about constructors 👇 Constructors don’t have a return type… But something still returns an object 🤯 Example: class User { User() { System.out.println("Constructor called"); } } User user = new User(); 👉 What’s actually happening? - "new" keyword creates the object - Allocates memory - Calls the constructor - Returns the reference 👉 Important: Constructor itself does NOT return anything 👉 "new" keyword returns the object --- 👉 This is NOT a constructor: class User { void User() { } ❌ } 👉 It becomes a normal method 💡 Many people think constructor returns object… but actually new keyword does that Did you know this? 👇 #Java #CoreJava #Programming #BackendDeveloper #Coding #TechLearning
To view or add a comment, sign in
-
Today I learned the difference between ArrayList and LinkedList in Java Collections. Both allow null values and duplicate elements, but they differ in performance and internal structure: 🔹 ArrayList: * Backed by a dynamic array * Faster for accessing elements (random access) * Slower for insertions and deletions (especially in the middle) * Provides three constructors 🔹 LinkedList: * Based on a doubly linked list * Faster for insertions and deletions * Slower for accessing elements (sequential traversal) * Provides two constructors Understanding when to use each helps in writing more efficient and optimized code. #Java #Collections #LearningJourney #DataStructures #TapAcademy
To view or add a comment, sign in
-
-
💻 Today I practiced a simple but important Java problem reading input until End of File (EOF). The task is to take input line by line and print each line along with its line number. Since we don’t know how many lines the user will enter, we use hasNextLine() inside a loop to keep reading until the input ends. I used a counter starting from 1, read each line using nextLine(), and printed it with the line number. Then I incremented the counter for the next line. This problem looks basic, but it’s very useful in coding platforms like HackerRank where input is not fixed. It also helps in understanding how input streams work in Java. Small problems like this really help in building strong fundamentals. #Java #CodingPractice #InterviewPreparation
To view or add a comment, sign in
-
-
💻 Java Practice Update | Second Largest Number in Array 📌 Problem: Find the second highest number in an array. 🧠 Approach: Maintain two variables: first and second Traverse the array once Update values based on comparison logic ⚙️ Key Learning: Improves problem-solving skills and helps build strong logic for coding interviews and automation testing scenarios. #Java #Arrays #CodingPractice #SDET #AutomationTesting
To view or add a comment, sign in
-
-
LeetCode Practice - 11. Container with Most Water The program is solved using JAVA. 🔑 Logic Summary 1. Take two pointers (start and end) 2. Calculate area 3. Store max area 4. Move smaller height pointer 5. Repeat until pointers meet #LeetCode #Java #CodingPractice #ProblemSolving #DSA #Array #DeveloperJourney #TechLearning
To view or add a comment, sign in
-
-
📘 Just shared my Core Java Notes (Collections Framework) I have covered important concepts like: ✔ Arrays vs Collections ✔ List, Set, Map ✔ ArrayList, LinkedList, HashMap, TreeSet ✔ Iterator, Comparator, Comparable ✔ Fail-Fast & Fail-Safe Collections This PDF will help beginners as well as interview preparation 💯 📌 Sharing my notes here — hope it helps someone in their learning journey. #Java #CoreJava #Collections #JavaDeveloper #Programming #InterviewPreparation
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