71 days strong. Small steps. Big consistency. ✅ 🚀 #Day71 of #100DaysOfCodeChallenge Today was about digit manipulation and careful validation logic. 📌 Problem 01: Check If The Number is Fascinating (Easy) A number is called fascinating if: When you concatenate n, 2*n, and 3*n, the resulting number contains all digits from 1 to 9 exactly once, and no zeros. 🧠 Logic: Compute 2*n and 3*n. Concatenate them with n into a single string. If total length is not 9 → return false. Use a boolean array to track digits (1–9). If any digit is 0 or repeated → return false. If all digits from 1 to 9 appear exactly once → return true. This problem looks simple, but it demands attention to edge cases and validation checks. Day 71 complete ✅ Discipline > motivation. Always. 🚀 #100DaysOfCode #Day71 #LeetCode #DSA #Math #Java #ProblemSolving #CodingJourney #LearnInPublic #Consistency
Day 71 of 100 Days of Code Challenge: Fascinating Numbers
More Relevant Posts
-
Day 67/100 – LeetCode Challenge ✅ Problem: #228 Summary Ranges Difficulty: Easy Language: Java Approach: Single Pass with Range Detection Time Complexity: O(n) Space Complexity: O(1) excluding output Key Insight: Track start of current consecutive range. When gap found (next ≠ previous + 1), close current range: Single number if start == previous Range "start → previous" otherwise Solution Brief: Iterated through array comparing consecutive elements. Detected breaks in consecutive sequences. Formatted ranges appropriately with arrow for multi-number ranges. Added final range after loop. #LeetCode #Day67 #100DaysOfCode #Array #Java #Algorithm #CodingChallenge #ProblemSolving #SummaryRanges #EasyProblem #RangeDetection #SinglePass #DSA
To view or add a comment, sign in
-
-
🚀 Day 81 / 100 – LeetCode Daily Challenge 📌 Problem: Minimum Partitions to Decompose a Number (1689) 🧠 Concept: Greedy | String Manipulation Today’s problem was deceptively simple but conceptually rich — finding the minimum number of deci-binary numbers needed to sum up to a given string n. The key insight? 🔍 The answer is simply the maximum digit in the string! Why? Because in any addition of deci-binary numbers (each made of only 0s and 1s), the largest digit in the target number dictates how many numbers are needed in the worst-case scenario. So if the number is "82734", we need at least 8 numbers (one for each unit at the position of '8'). ✅ One pass. One max check. Clean and greedy. 📊 Runtime: 6 ms | Beats 75.56% 💾 Memory: 47.43 MB ✨ Key takeaway: Sometimes the most efficient solution is hiding in plain sight — just read the problem carefully and think about the underlying constraints. #LeetCode #CodingJourney #100DaysOfCode #Day81 #GreedyAlgorithm #Java #ProblemSolving #TechCommunity #DevLife #CodeNewbie
To view or add a comment, sign in
-
-
🔥 Day 99/100 – LeetCode Challenge Today’s problem was 673. Number of Longest Increasing Subsequence. Given an integer array nums, the goal is to determine how many longest strictly increasing subsequences exist in the array. Unlike the classic Longest Increasing Subsequence (LIS) problem where we only find the length, this problem requires counting how many subsequences achieve that maximum length. 💡 Approach I used Dynamic Programming with two arrays: dp[i] → stores the length of the longest increasing subsequence ending at index i count[i] → stores the number of LIS ending at index i For every pair (j, i) where j < i: If nums[i] > nums[j], it can extend the subsequence. If we find a longer subsequence → update length and copy count. If we find another subsequence of the same length → add counts. Finally, we sum the counts of all subsequences whose length equals the maximum LIS length. ⏱ Complexity Time Complexity: O(n²) Space Complexity: O(n) This problem deepens the understanding of dynamic programming transitions and counting paths, which is a very common pattern in advanced DP problems. On to the final day tomorrow! 💯🔥 #Day99 #100DaysOfLeetCode #LeetCode #DSA #DynamicProgramming #CodingChallenge #Java #SoftwareEngineering #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 531 of #750DaysOfCode 🚀 💻 LeetCode 1415 — The K-th Lexicographical Happy String of Length n Today’s problem was a great practice of Backtracking + Recursion + Lexicographical order generation. We are given a length n and a number k, and we need to find the k-th happy string in sorted order. 🔹 A happy string means: Only contains characters → a, b, c No two adjacent characters are same Example: Valid → "abc", "acb", "bab" Invalid → "aa", "abb", "bcc" The challenge was to generate all valid strings in lexicographical order and return the k-th one. 💡 Approach Used: Backtracking (DFS) Try characters in order → a, b, c Skip same adjacent character Stop early when k-th string found This problem improved my understanding of: ✔ Recursion ✔ Backtracking ✔ String generation ✔ Lexicographical traversal ✔ Early stopping optimization Consistency is the key — one problem every day, no excuses. 🔥 #750DaysOfCode #Day531 #LeetCode #Java #Backtracking #Recursion #DSA #CodingJourney #SoftwareEngineer #PlacementPreparation
To view or add a comment, sign in
-
-
Day 14/30 – LeetCode streak Today’s problem: Concatenation of Consecutive Binary Numbers You need the decimal value of '1' + '2' + '3' + ... + 'n' written in binary back-to-back, all under mod (10^9 + 7). Core trick: treat “concatenate in binary” as shift + OR: * When you append 'i' to the right, you’re really shifting the current result left by 'bits(i)' and OR-ing 'i' into the free space. * The number of bits only increases when 'i' hits a power of two (1, 2, 4, 8, …), so you just track 'bits' and bump it whenever '(i & (i - 1)) == 0'. Day 14 takeaway: Once you see that “stick this binary to the right” is the same as “shift by its bit length and OR”, the whole problem becomes a clean for-loop plus the power-of-two trick—no string building or big integer juggling needed. #leetcode #dsa #java #bitmanipulation #consistency
To view or add a comment, sign in
-
-
Day 55: Root-to-Leaf Grinding 🌳 Problem 1022: Sum of Root To Leaf Binary Numbers Back to trees. The goal: sum binary paths from root to leaf. The Strategy: • DFS Brute Force: Stack-based traversal to explore every branch. • Path Tracking: Dragging binary strings down the tree like a heavy backpack. • Conversion: Hit a leaf, parse the string to base 2, add to sum. Ngl, string concatenation in a loop is a bit mid for efficiency, but it got the job done. Bitwise shortcuts are next on the menu. We move. 🚀 #LeetCode #Java #BinaryTree #DFS #Coding #DailyCode
To view or add a comment, sign in
-
-
🚀 Day 511 of #750DaysOfCode 🚀 🔢 762. Prime Number of Set Bits in Binary Representation (LeetCode - Easy) Today’s problem was a beautiful mix of bit manipulation + prime checking. 🧠 Problem Summary Given two integers left and right, count how many numbers in that range have a prime number of set bits (1s) in their binary representation. 📌 Example: 21 → Binary: 10101 Set bits = 3 → 3 is prime ✅ 💡 Key Observations We need to: Convert each number to binary. Count the number of set bits. Check if that count is prime. Since right ≤ 10^6, the maximum number of set bits possible is 20 (because 2²⁰ ≈ 10⁶). 👉 So instead of checking prime again and again, we can pre-store prime numbers up to 20. 🔥 What I Practiced Today Using Integer.bitCount() efficiently Understanding binary representations deeply Optimizing prime checks for small ranges Clean looping logic 🎯 Time Complexity O(N * sqrt(K)) Where: N = right - left K ≤ 20 (max set bits) So practically very efficient 🚀 💬 Takeaway Sometimes an “Easy” problem is about combining two simple concepts correctly: 👉 Bit manipulation 👉 Prime number checking Consistency > Difficulty. #750DaysOfCode #Day511 #LeetCode #Java #BitManipulation #PrimeNumbers #ProblemSolving #DataStructuresAndAlgorithms
To view or add a comment, sign in
-
-
🚀 Day 23/100 – LeetCode Challenge Today’s problem: Partitioning Into Minimum Number of Deci-Binary Numbers 🔹 Key Insight: The minimum number of deci-binary numbers required is equal to the maximum digit present in the string. 🔹 Approach: Traverse through each character in the string Convert it to integer (ch - '0') Track the maximum digit Return the maximum value 🔹 Time Complexity: O(n) 🔹 Space Complexity: O(1) ✨ Simple logic, but powerful observation! Instead of constructing numbers, we just analyze the digits. Consistency > Motivation 💪 #Day23 #100DaysOfCode #LeetCode #Java #ProblemSolving #CodingJourney
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
Discipline and consistency define success. keep growing bro