Can you reach the last index in the Jump Game challenge?

🚀 Day 9 of 30: Coding Challenge ❓ Can you always reach the last index? 🔹 Problem: Jump Game Today I solved a problem where I had to check if it’s possible to reach the last index based on jump lengths at each position. 💡 What I learned: We don’t need to try all jumps. Instead, we can track the position from where the end is reachable. 🧠 Approach: Start from the last index and treat it as the goal Traverse the array backwards If current index + jump length ≥ goal → update goal At the end, if goal becomes 0 → we can reach the end ⏱️ Complexity: Time: O(n) Space: O(1) 😅 My experience: Initially, I thought this required DP or recursion, but the greedy approach made it much simpler. 📌 Pattern: Greedy Approach Learning step by step and staying consistent 💻 Have you tried solving this with a different approach? 🤔 #coding #learning #datastructures #algorithms #leetcode #codingchallenge #30DaysOfCode #developers #programming #codingjourney #tech

  • graphical user interface, text

To view or add a comment, sign in

Explore content categories