Skip to content
Forge Learn/Welcome to Algorithm Fundamentals

Setting Up: The Forge Editor & How Your Code Gets Graded

5 min read

You'll learn to

  • -Know what a Forge Algorithm Lab level gives you and what you're expected to fill in
  • -Understand how a submission is actually graded, end to end
  • -Know what the Blacksmith and target complexity are, and when to use them

Before you touch the lab for real (starting later in this course), it's worth knowing exactly what happens when you do. Every Forge level opens in a code editor pre-loaded with starter code: a scenario describing the problem, a function signature you must not rename, and one or more TODO comments marking exactly where your logic belongs. Your job is never to build the whole program from nothing - it's to fill in the gap correctly.

Starter Code and TODOs

A typical starter file looks something like this - a function stub with a docstring describing what it must return, and a placeholder value where your real logic goes:

def analyze_complexity(arr):
    """
    TODO: Analyze the time complexity of each function below.
    Return a dict with function names as keys and their O() as values.
    """
    pass

That "pass" (and the TODO above it) is exactly what you replace. The function name and its parameters are part of the contract - the grader calls your function by that exact name with specific arguments, so renaming it or changing what it returns breaks grading even if your logic is otherwise correct.

Hidden Test Cases: How Grading Actually Works

When you hit Submit, your code doesn't just run once - it runs inside an isolated sandboxed process against a set of test cases, most of which you never see up front. Each test case calls your function with specific inputs and checks the output against an expected value. Passing the visible example in the scenario description is a good sign, but it is not the same as passing every hidden case - edge cases like empty inputs, duplicates, or unusual orderings are exactly what the hidden tests are there to catch.

  • -Your submission is graded on whether every test case passes, not on how the code "looks."
  • -A level also shows a target time complexity and target space complexity - a benchmark for how efficient the intended solution is, separate from correctness.
  • -Passing all tests with a much worse complexity than the target usually still passes, but it's a signal you haven't found the intended approach yet - something you'll build real intuition for once Big-O is covered in depth in Phase 2.

The Blacksmith: Getting Unstuck Without Getting the Answer

Every level has a built-in hint system, nicknamed the Blacksmith - a series of progressively more specific nudges (and, on some levels, AI-generated hints tailored to your actual attempt) that steer you back toward the right idea without just handing you the solution. Reaching for a hint after a genuine attempt is normal, not a failure; the goal is understanding, not a clean first try.

Python First, Java Optional

Every Forge level supports both Python and Java submissions, so if you already know Java you're free to solve levels in it. This course, however, teaches Python from scratch, since it's the primary language of the lab and the friendlier one to learn programming with for the first time - fewer ceremony keywords standing between you and the idea you're trying to express.

Nothing in this chapter needs you to open the editor yet - Phase 1 is about learning the language first. Once the Lab Bridges start (soon), this is exactly the workflow you'll be using for real.

ScaleDojo Logo
Initializing ScaleDojo