𝐉𝐚𝐯𝐚 𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐅𝐥𝐨𝐰 𝐢𝐧 𝐀𝐜𝐭𝐢𝐨𝐧: 𝐂𝐋𝐈 𝐂𝐚𝐥𝐜𝐮𝐥𝐚𝐭𝐨𝐫. 🧮 I built a CLI Calculator to test my understanding of Java's control flow statements. Instead of a simple linear script, I implemented: 𝐂𝐨𝐧𝐭𝐢𝐧𝐮𝐨𝐮𝐬 𝐈𝐧𝐩𝐮𝐭: Wrapped the logic in a while loop. 𝐎𝐩𝐞𝐫𝐚𝐭𝐨𝐫 𝐇𝐚𝐧𝐝𝐥𝐢𝐧𝐠: Parsed char inputs to direct program flow. 𝐌𝐚𝐭𝐡 𝐋𝐨𝐠𝐢𝐜: Handled standard and modular arithmetic dynamically. 𝐓𝐞𝐜𝐡𝐧𝐢𝐜𝐚𝐥 𝐈𝐦𝐩𝐥𝐞𝐦𝐞𝐧𝐭𝐚𝐭𝐢𝐨𝐧𝐬 : 𝐒𝐭𝐚𝐭𝐞 𝐌𝐚𝐧𝐚𝐠𝐞𝐦𝐞𝐧𝐭: Maintained program execution using a while loop. 𝐂𝐨𝐧𝐝𝐢𝐭𝐢𝐨𝐧𝐚𝐥𝐬: Used complex if/else logic to handle operators (+, -, *, /) and modulo (%). 𝐈𝐧𝐩𝐮𝐭 𝐇𝐚𝐧𝐝𝐥𝐢𝐧𝐠: Processed standard input via Scanner for dynamic variable assignment. 𝐂𝐡𝐞𝐜𝐤 𝐨𝐮𝐭 𝐭𝐡𝐞 𝐝𝐞𝐦𝐨 𝐛𝐞𝐥𝐨𝐰. 👇 #Java #Coding #TechTips #LearningInPublic #BackEnd #computer #science #engineering #learning #WeMakeDevs #IntelliJ #100DaysOfCode
More Relevant Posts
-
Day 4/100 – LeetCode Challenge Problem: Valid Anagram Today’s problem focused on string comparison using frequency counting instead of sorting. Problem Statement: Given two strings s and t, determine if t is an anagram of s. An anagram means: Same characters Same frequency Order does NOT matter Approach (Optimized – O(n)): If lengths are different → return false Create an integer array of size 26 (for lowercase letters) Increment count for characters in s Decrement count for characters in t If all values are zero → valid anagram This ensures: Time Complexity: O(n) Space Complexity: O(1) (fixed array of size 26) Key Concepts Practiced: Hashing technique Character indexing using ASCII (char - 'a') Optimizing from sorting to counting Constant space optimization #100DaysOfCode #LeetCode #DSA #Java #CodingInterview #SoftwareEngineerJourney #ProblemSolving
To view or add a comment, sign in
-
-
💡 Understanding the Boolean Concept in Programming The Boolean data type represents a logical value: true or false. It is fundamental for implementing conditional logic, control flow, and decision-making in programming. Boolean values are typically produced through relational and logical operations such as: Relational operators: >, <, ==, !=, >=, <= Logical operators: && (AND), || (OR), ! (NOT) 🔹 Example in Java: int age = 20; boolean isEligible = age >= 18; if(isEligible && age < 60){ System.out.println("Eligible for registration"); } In this example, the Boolean expression evaluates conditions and controls the execution flow of the program. Boolean logic plays a critical role in algorithms, validations, filtering data, and controlling application behavior. #Java #ProgrammingConcepts #BooleanLogic #CodingJourney #SoftwareDevelopment 🚀
To view or add a comment, sign in
-
-
Day 5/100 – LeetCode Challenge Problem: Word Search Today’s challenge was a classic 2D Matrix + DFS + Backtracking problem. Problem Summary: Given a 2D board of characters and a word, determine if the word exists in the grid. Rules: Adjacent cells = horizontal or vertical A cell cannot be reused in the same path Approach Used: Traverse every cell as a starting point Apply Depth First Search (DFS) Mark visited cells temporarily Backtrack after exploring all 4 directions Core idea: Base case → If index == word.length() → return true Boundary check + character match validation Mark visited → Explore → Restore (Backtracking) Key Concepts Practiced: Recursion Backtracking 2D matrix traversal State modification & restoration Time Complexity: O(m × n × 4^L) (L = length of word) This problem reinforced an important lesson: Backtracking is about exploring possibilities and undoing choices efficiently. #100DaysOfCode #LeetCode #DSA #Java #Backtracking #SoftwareEngineerJourney #CodingInterview
To view or add a comment, sign in
-
-
🚀 Day 88 of 100 Days of LeetCode Problem: Min Cost Climbing Stairs Difficulty: Easy Today’s problem was another classic Dynamic Programming pattern. Each step has a cost, and you can climb either 1 or 2 steps at a time. The goal is to reach the top with the minimum total cost. You can start from index 0 or index 1. The key idea: To reach step i, you must come from either i-1 or i-2. So the recurrence becomes: dp[i] = cost[i] + min(dp[i-1], dp[i-2]) Finally, since you can reach the top from the last or second-last step: answer = min(dp[n-1], dp[n-2]) This problem reinforces the “take minimum of previous two states” DP pattern — very similar to Climbing Stairs but focused on cost minimization instead of counting ways. Time Complexity: O(n) Space Complexity: O(n) → can be optimized to O(1) Another solid DP variation completed. On to Day 89 💪 #LeetCode #100DaysOfCode #DSA #DynamicProgramming #Java #Algorithms #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Understanding Data Types can completely change how you write code 👨💻 This visual explains something every programmer must master: Type Declaration, Arithmetic, and Type Conversion. 🔹 When you assign 3.5 to an int, it becomes 3 That’s called demotion → precision is lost. 🔹 When you assign 8 to a float, it becomes 8.0 That’s promotion → precision is preserved. Now look at division: 5 / 2 = 2 → because both are integers 5.0 / 2 = 2.5 → because one operand is float Same numbers. Different data types. Different results. This is why understanding type casting and arithmetic behavior is fundamental in C, C++, Java, and many other languages. Small concepts like this prevent big logical errors in real-world applications. #Programming #CProgramming #CPP #CodingBasics #SoftwareDevelopment
To view or add a comment, sign in
-
-
Day 11 of Daily DSA 🚀 Solved LeetCode 1800: Maximum Ascending Subarray Sum ✅ 🔍 Approach: Iterated through the array while maintaining the sum of the current strictly increasing subarray. Whenever the sequence breaks, a new subarray sum is started and stored. Finally, the maximum subarray sum is obtained from the stored values. This method clearly separates each ascending subarray and helps in understanding the problem flow. ⏱ Complexity: • Time: O(n) — single traversal + max lookup • Space: O(n) — list used to store subarray sums 📊 LeetCode Stats: • Runtime: 1 ms ⚡ • Memory: 43.30 MB A good learning step before optimizing further to constant space. #DSA #LeetCode #Java #Arrays #ProblemSolving #DailyCoding #Consistency
To view or add a comment, sign in
-
-
Day 10 of Daily DSA 🚀 Solved LeetCode 190: Reverse Bits ✅ 🔍 Approach: Worked with the 32-bit representation of the given integer: • Converted the number into a fixed 32-bit binary string • Used a two-pointer technique to reverse the bits • Converted the reversed binary back to an unsigned integer This approach keeps the logic simple while ensuring correctness for signed integers. ⏱ Complexity: • Time: O(32) = O(1) (constant time) • Space: O(32) = O(1) 📊 LeetCode Stats: • Runtime: 9 ms • Memory: 43.46 MB A good reminder that clarity matters more than micro-optimizations when learning bit manipulation. #DSA #LeetCode #Java #BitManipulation #ProblemSolving #DailyCoding #Consistency
To view or add a comment, sign in
-
-
After reading and understanding the question and the test cases for LeetCode 1689 – Partitioning Into Minimum Number of Deci-Binary Numbers, my first thought was to build the sum using deci-binary numbers (0s and 1s) and then count how many numbers are required. That approach felt natural because Example 1 itself explains the solution like this: Input: n = "32" Output: 3 Explanation: 10 + 11 + 11 = 32 So my thinking was to follow the same idea — construct the sum first and then count the numbers. But when I looked at Example 3: Input: n = "27346209830709182346" Output: 9 and noticed the constraint: 1 <= n.length <= 10^5 it became clear that converting the string into numeric types or constructing the sum directly would not scale given the constraints. After carefully going through the hints and the solution, I understood the key insight: Each deci-binary number can contribute only 0 or 1 per digit. So if any digit in the string is 9, we need at least 9 deci-binary numbers to form that digit. Since all digits must be satisfied together, the maximum digit in the string decides the minimum number of deci-binary numbers required. This problem was a good reminder that sometimes the challenge isn’t coding — it’s thinking about constraints the right way. #LeetCode #ProblemSolving #DSA #Learning #Java
To view or add a comment, sign in
-
-
🎯 Day 100 of #100DaysOfCode 🔥 What a way to wrap it up! Solved LeetCode #3666 – Minimum Operations to Equalize Binary String ✅ A problem that blends math, parity logic, and careful case analysis—not your usual binary flip question. Key takeaways: -> Count-based optimization over brute force -> Handling even/odd operation patterns smartly -> Early exits = cleaner & faster logic -> Thinking in terms of operations feasibility rather than simulation 🧠 Language: Java -> Runtime: 0 ms (Beats 83.87%) -> Memory: 47.90 MB 100 days. Countless problems. One habit built: consistency 💪 Onward to harder problems and deeper concepts 🚀 #LeetCode #Java #DSA #BinaryStrings #ProblemSolving #Consistency #100DaysChallenge
To view or add a comment, sign in
-
-
🚀 Day 5/50 – LeetCode Challenge 🧩 Roman to Integer Today’s problem focused on converting a Roman numeral into its integer equivalent — a great exercise in understanding patterns and rules in string processing. 📌 Problem Summary: Given a Roman numeral, convert it into an integer. Roman numerals follow specific rules, especially the subtraction rule: IV = 4 IX = 9 XL = 40 CM = 900 🔍 Approach Used: Mapped each Roman symbol to its integer value Traversed the string from left to right Compared current value with the next value If the next value is greater → subtract Otherwise → add This helps correctly handle cases like IV, IX, XL, etc. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(1) 💡 Key Learning: ✔️ Understanding rule-based logic ✔️ Handling special subtraction cases ✔️ Efficient string traversal ✔️ Using maps for faster lookups A simple-looking problem that strengthens logical thinking and pattern recognition. Consistency is the real progress 🚀 🔗 Problem Link: https://lnkd.in/g4Z36z3c #50DaysOfLeetCode #LeetCode #DSA #Java #Strings #ProblemSolving #CodingJourney #FutureAIEngineer #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