Java DSA Day 19: Largest Odd Number in a String

🚀 Day 19 / 180 – DSA with Java 🚀 📘 Topic Covered: Strings & Greedy Traversal 🧩 Problem Solved: Largest Odd Number in a String Problem: Given a numeric string, return the largest-valued odd-numbered substring. If no odd digit exists, return an empty string. Approach: Traversed the string from right to left to find the first odd digit. Once found, returned the substring from the start up to that index to ensure the largest possible odd number. Key Learning: ✔️ Observing patterns to reduce unnecessary computation ✔️ Efficient right-to-left traversal ✔️ Applying greedy thinking in string problems If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Strings #ProblemSolving #Consistency

  • text

To view or add a comment, sign in

Explore content categories