Skip to main content

Easy Problems (21 Problems)

Overview

The Easy difficulty tier features 21 foundational problems that establish core algorithmic thinking and data structure knowledge. These problems are essential building blocks for interview success and form the basis for tackling more complex challenges.

What You’ll Learn

  • Array & Hash Table Fundamentals - Understanding time-space tradeoffs
  • Two Pointer Techniques - Efficient in-place array manipulation
  • String Processing - Pattern recognition and validation
  • Tree Traversal Basics - DFS and BFS fundamentals
  • Stack Applications - Parsing and validation problems

Study Approach

For Beginners:
  1. Start with #017 (Two Sum) - the classic hash table problem
  2. Move to #020 (Valid Parentheses) - essential stack pattern
  3. Practice #029 (Valid Palindrome) - master two pointers
  4. Build up to tree problems (#014, #027)
For Interview Prep:
  • Aim to solve each problem in 15-20 minutes
  • Focus on clean, readable code
  • Practice explaining your approach out loud
  • Test with edge cases (empty input, single element, duplicates)
Estimated Time Investment:
  • First-time learning: 25-35 hours
  • Interview refresh: 8-12 hours
  • Quick review: 3-5 hours

Problems by Category

Array & Hashing (2 problems)

#017 - Two Sum

Frequency: 76.4% | Hash table, array fundamentals

#089 - Range Sum Query - Immutable

Frequency: 32.0% | Prefix sum, array preprocessing

Two Pointers (6 problems)

#002 - Valid Word Abbreviation

Frequency: 95.4% | String validation, two pointers

#029 - Valid Palindrome

Frequency: 69.5% | Classic two pointer pattern

#033 - Merge Sorted Array

Frequency: 67.4% | In-place merging

#044 - Squares of a Sorted Array

Frequency: 59.4% | Two pointer optimization

#078 - Strobogrammatic Number

Frequency: 40.7% | String pattern matching

#028 - Dot Product of Two Sparse Vectors

Frequency: 69.5% | Sparse data structures (MEDIUM difficulty in some contexts)

Binary Search Tree (2 problems)

#027 - Range Sum of BST

Frequency: 69.5% | BST properties, tree traversal

#060 - Closest Binary Search Tree Value

Frequency: 47.0% | BST search, nearest value

Binary Search (1 problem)

#041 - Kth Missing Positive Number

Frequency: 59.4% | Binary search application

Tree (1 problem)

#014 - Diameter of Binary Tree

Frequency: 79.2% | DFS, tree path problems

Palindrome (1 problem)

#004 - Valid Palindrome II

Frequency: 92.7% | Palindrome validation with modifications

Parentheses (1 problem)

#020 - Valid Parentheses

Frequency: 74.9% | Stack fundamentals, matching pairs

String (2 problems)

#043 - Longest Common Prefix

Frequency: 59.4% | String processing

#047 - Missing Ranges

Frequency: 56.0% | Range manipulation

#095 - Goat Latin

Frequency: 32.0% | String transformation

Sliding Window (1 problem)

#068 - Contains Duplicate II

Frequency: 40.7% | Hash table, sliding window basics

Design (1 problem)

#048 - Moving Average from Data Stream

Frequency: 56.0% | Queue, streaming data

Dynamic Programming (1 problem)

#018 - Best Time to Buy and Sell Stock

Frequency: 76.4% | Kadane’s algorithm variant

Math & Compute (2 problems)

#050 - Add Strings

Frequency: 51.9% | String arithmetic

#085 - Add Two Integers

Frequency: 32.0% | Bit manipulation basics

High Priority Problems

These easy problems appear most frequently in interviews:
  1. #002 - Valid Word Abbreviation (95.4%) - String validation essential
  2. #004 - Valid Palindrome II (92.7%) - Greedy algorithm intro
  3. #014 - Diameter of Binary Tree (79.2%) - Tree fundamentals
  4. #017 - Two Sum (76.4%) - The classic hash table problem
  5. #018 - Best Time to Buy and Sell Stock (76.4%) - Dynamic programming intro
  6. #020 - Valid Parentheses (74.9%) - Stack pattern essential

Common Patterns

Pattern 1: Hash Table for O(1) Lookup

Problems: #017, #068 Key Insight: Trade space for time by storing seen elements

Pattern 2: Two Pointers for In-Place Operations

Problems: #029, #033, #044, #004 Key Insight: Avoid extra space by using multiple indices

Pattern 3: Stack for Matching/Validation

Problems: #020 Key Insight: LIFO structure perfect for nested structures

Pattern 4: Tree DFS for Path Problems

Problems: #014, #027 Key Insight: Use recursion to explore all paths

Study Tips

Mastering Easy Problems

  1. Understand Before Coding
    • Draw examples on paper
    • Identify edge cases first
    • Think through brute force before optimizing
  2. Focus on Fundamentals
    • Hash tables: O(1) lookups (#017)
    • Two pointers: In-place operations (#029, #033)
    • Stacks: Matching pairs (#020)
    • Trees: DFS/BFS traversal (#014, #027)
  3. Practice Communication
    • Explain approach before coding
    • Walk through examples
    • Discuss time/space complexity
  4. Test Systematically
    • Empty input
    • Single element
    • Duplicates
    • Maximum constraints

Common Mistakes to Avoid

  • Off-by-one errors in array indexing
  • Null/empty checks especially for trees and strings
  • Integer overflow in arithmetic problems
  • Mutating input when not allowed

Progression Path

Phase 1: Core Data Structures (Week 1)

  • Arrays & Hashing: #017, #089
  • Two Pointers: #029, #033, #044
  • Stacks: #020

Phase 2: Trees & Strings (Week 2)

  • Trees: #014, #027, #060
  • Strings: #002, #043, #047
  • Palindromes: #004, #029

Phase 3: Advanced Techniques (Week 3)

  • Binary Search: #041
  • Sliding Window: #068
  • Design: #048
  • Dynamic Programming: #018

Ready for Medium?

You’re ready to tackle medium problems when you can:
  • Solve any easy problem in under 20 minutes
  • Explain your approach clearly
  • Identify the correct pattern immediately
  • Handle edge cases without hints
  • Optimize for time AND space complexity

Next: Medium Problems

Progress to 63 medium-level problems that build on these foundations

Quick Reference

Total Problems: 21 Average Frequency: 61.7% Recommended Time: 15-20 minutes per problem Total Study Time: 25-35 hours (first attempt) Key Categories:
  • Two Pointers: 6 problems
  • String: 3 problems
  • Array & Hashing: 2 problems
  • BST: 2 problems
  • Math: 2 problems
  • Trees: 1 problem
  • Stack: 1 problem
  • Binary Search: 1 problem
  • Sliding Window: 1 problem
  • Design: 1 problem
  • Dynamic Programming: 1 problem

Build docs developers (and LLMs) love