← Back to Games

🏃 Linear Road Runner

Walk through N tiles and visualize O(N) linear time complexity!

🛤️ The Linear Road
0
Steps Taken
10
Array Size (N)
O(N)
Time Complexity
1
Loop Passes

⚠️ Trap Activated!

You're looping more than once! This increases complexity to O(2N) or worse!

⚙️ Loop Configuration
O(N)
Single Pass
O(2N)
Double Pass
O(3N)
Triple Pass
O(1)
Constant Access
for (int i = 0; i < N; i++) {
visit(arr[i]); // Process element
}
// Total: N iterations → O(N)
🐢 🐇

📚 Understanding O(N) Linear Complexity

O(N) means the number of operations grows linearly with input size N.

Real examples of O(N): Finding sum, finding max/min, linear search, printing all elements