NTU Coding Nights 3.0 • Night 1

Interactive Workbook Guide

A complete zero-panic beginner's guide to launching, editing, and verifying your solutions in Google Colab and local Python.

1 Launching via Google Colab (Recommended)

Google Colab runs entirely in your web browser. You do not need to install Python, Jupyter, or Git on your machine.

Step 1: Open the Notebook

Click the golden "Open in Google Colab" button at the top of this page or inside the GitHub repository.

⚠️ Crucial Step: Save a Copy to Google Drive
Colab initially opens in temporary "Playground" mode. To save your solutions permanently:
Click File ➔ Save a copy in Drive in the top menu. This creates a personal copy in your Google Drive.

Step 2: How to Run Code

Step 3: Solving & Testing

Each problem has two cells: your starter template and an automated test suite. Replace the pass keyword with your code and run the test cell below it:

def contains_duplicate(nums: list[int]) -> bool:
    seen = set()
    for num in nums:
        if num in seen:
            return True
        seen.add(num)
    return False

When you run the test cell and see [PASS] All tests passed!, your solution is verified!

2 Running Locally with VS Code & Python

If you prefer an offline development environment on your laptop:

1. Clone the Repository

git clone https://github.com/evecount/algorithmic-thinking-starter.git
cd algorithmic-thinking-starter

2. Run the Benchmark Test Suite

python solutions.py

3. Open in VS Code

code .

Open notebooks/interactive_workbook.ipynb. VS Code will prompt you to install the Python/Jupyter extension. Select your Python kernel in the top-right and run cells locally!

3 Visualizing with PythonTutor

If you are struggling to visualize how pointers move or how a Hash Map grows in memory:

  1. Visit pythontutor.com.
  2. Select Python 3.11.
  3. Paste your function code and test call.
  4. Click Visualize Execution and step through line-by-line to watch call frames, pointer arrows, and dictionary buckets animate in real time!

4 Common Beginner Errors & Fixes

IndentationError

Python requires consistent 4-space indentation. Verify all lines inside def, for, and if blocks align perfectly.

IndexError: Out of Range

Occurs when arr[i] attempts to access an index beyond the array size. Always guard pointer loops: while left < right and ...

AssertionError: Test Failed

Your code returned an unexpected output for a specific edge case. Check if your solution handles empty strings or single-element lists properly.

Infinite Execution Loop

If a cell runs indefinitely without stopping, your while loop forgot to increment left += 1 or decrement right -= 1.