Pattern 1
Accumulator (Sum / Count / Max / Min)
The most common FRQ pattern. Traverse the array and accumulate a result.
// SUM
int total = 0;
for (int i = 0; i < arr.length; i++)
{
total += arr[i];
}
// COUNT matching condition
int count = 0;
for (int val : arr)
{
if (val > threshold)
{
count++;
}
}
// MAX
int max = arr[0];
for (int i = 1; i < arr.length; i++)
{
if (arr[i] > max)
{
max = arr[i];
}
}
Scoring Points
+1 for correct initialization. +1 for correct loop bounds. +1 for correct accumulation logic. +1 for returning the result. Starting max at 0 instead of arr[0] is a common penalty.
Pattern 2
Sequential Search
Find an element or its index in an unsorted array.
public static int findIndex(int[] arr, int target)
{
for (int i = 0; i < arr.length; i++)
{
if (arr[i] == target)
{
return i;
}
}
return -1; // not found
}
Scoring Points
+1 for traversing the entire array. +1 for correct comparison. +1 for returning the correct index. +1 for returning -1 when not found. Using .equals() for objects vs == for primitives matters.
Pattern 3
Build New Collection From Existing
Create a new ArrayList by filtering elements from an array or another list.
public static ArrayListfilterLong(String[] words, int minLen) { ArrayList result = new ArrayList (); for (int i = 0; i < words.length; i++) { if (words[i].length() >= minLen) { result.add(words[i]); } } return result; }
Scoring Points
+1 for creating the new ArrayList. +1 for correct traversal. +1 for correct filter condition. +1 for adding matching elements. +1 for returning the result.
Master Every FRQ Pattern
The Cram Kit walks you through each pattern with daily FRQ practice and scoring breakdowns.
Get the Cram Kit — $29.99 1-on-1 TutoringPattern 4
Adjacent Element Comparison
// Find consecutive duplicates
for (int i = 0; i < arr.length - 1; i++)
{
if (arr[i] == arr[i + 1])
{
System.out.println("Duplicate at " + i);
}
}
// Note: loop stops at length - 1 to prevent out of bounds
Pattern 5
In-Place Modification
// Double every element
for (int i = 0; i < arr.length; i++)
{
arr[i] = arr[i] * 2;
}
// Must use standard for loop (enhanced for cannot modify)
== instead of .equals() for Strings, returning from inside a loop incorrectly, off-by-one in loop bounds, and declaring a local variable that shadows an instance variable.