A small collection of Core Java array practice problems and example solutions. This repo contains beginner-friendly implementations grouped by approach (two-pointers, brute-force, 2D array exercises, sliding window, etc.).
- Practice problems implemented in plain Java (.java files).
- Example categories:
- Two pointers
- Brute-force approaches
- Sliding window
- 2D array exercises (matrix addition, transpose, multiplication)
Arrays/— core array examples and exercises2D_Array/— matrix and 2D-array problemsBrute_Force_Approach/— straightforward solutionsSliding_Window/— sliding-window examplesTwo pointers/— two-pointer technique problems
Examples include: SortArray.java, RotateArray.java, PrimeArray.java, MaxSumSubarray.java, MatrixMultiplication.java, and more.
Open a terminal (PowerShell) in the repository root or the specific folder and run:
# compile
javac Arrays\SortArray.java
# run (use the class name without .java)
java Arrays.SortArrayIf a file is inside a package or the package statement is used, adjust the commands accordingly or compile from the project root respecting the package path.
- Feel free to open issues for bugs or suggested problems.
- Pull requests are welcome. Keep solutions simple and add comments where helpful.
- If adding multiple new exercises, include a brief README in the folder describing the new content.
This repository is intended for learning and practice. If you reuse code in other projects, please attribute or fork as appropriate.
Happy coding! 🧑💻