codejeet
CompaniesLearnBlogTrackerSystem DesignPodcast
Learn

Arrays — Easy

Linear scans, two-pass tricks, basic counting. The first set of array problems every interviewer expects you to do without thinking.

C++JavaScriptPythonJava

Lessons

  1. 01
    Largest element
    Scan the array, remember the biggest value you've seen so far.
    C++JavaScriptPython
  2. 02
    Second largest element
    One pass, two variables. Watch out for duplicates of the maximum.
    C++JavaScriptPython
  3. 03
    Check if an array is sorted
    Compare adjacent pairs. The moment you find one out of order, you can stop.
    C++JavaScriptPython
  4. 04
    Remove duplicates from a sorted array
    Two pointers in one pass. The classic in-place de-dup pattern.
    C++JavaScriptPython
  5. 05
    Left rotate by one
    Save the first element, shift everything left, drop it at the end.
    C++JavaScriptPython
  6. 06
    Move zeros to end
    Two pointers again: one walks the array, one tracks where the next non-zero goes.
    C++JavaScriptPython

Quizzes

  1. Q01
    Array basics
    Quick sanity check on indexing, complexity and the two-pointer pattern.
    5 questions
  2. Q02
    Predict the output
    Trace these small array snippets by hand and predict what they print.
    5 questions
CompaniesTrackerBlogSystem DesignPodcast
Built with by shydev
CompaniesTrackerBlogSystem DesignPodcast