DEV Community

hassam bin shahid
hassam bin shahid

Posted on

🚀 My Daily DSA Practice – Solving 6 LeetCode Problems (Greedy + Arrays)

📌 Introduction

Today I focused on strengthening my understanding of Greedy Algorithms and Array-based problems by solving multiple LeetCode questions.

This practice helped me improve my pattern recognition, problem-solving speed, and coding efficiency in Python.

🧠 Problems Solved

  1. Sign of the Product of an Array

Instead of calculating full multiplication, we only track:

Number of negative values
Presence of zero

👉 Key idea:

Even negatives → 1
Odd negatives → -1
Zero → 0

  1. Is Subsequence

Used Two Pointers Technique:

Traverse both strings
Match characters in order

👉 Time Complexity: O(n)

  1. Best Time to Buy and Sell Stock II

Used Greedy Approach:

Add every positive difference

👉 Idea: Profit comes from every upward trend.

  1. Can Make Arithmetic Progression Sort array Check constant difference between elements

👉 Time Complexity: O(n log n)

  1. Increasing Triplet Subsequence

Used greedy tracking:

first smallest
second smallest larger than first

👉 If third number found → return True

  1. Jump Game

Track maximum reachable index:

If index > max reach → return False
💡 Key Learnings
Greedy algorithms simplify complex problems using local optimal choices.
Two pointers help reduce nested loops to linear time.
Tracking variables (min, max, bounds) is often enough instead of brute force.
Pattern recognition is the most important skill in DSA.
⚡ Skills Improved Today
Greedy Algorithms
Two Pointers Technique
Array Manipulation
Time Complexity Optimization
Python Problem Solving
🚀 Conclusion

Consistency is the key in mastering DSA. Each problem improves my ability to think logically and recognize patterns faster.

I will continue solving problems daily and sharing my learning journey.

Top comments (1)

Collapse
 
topstar_ai profile image
Luis Cruz

Consistency is the real advantage when it comes to DSA practice. Solving problems daily builds pattern recognition, which is often more valuable than memorizing individual solutions. Great discipline — combining LeetCode practice with understanding the underlying algorithms will definitely pay off in real-world problem solving. Keep going!