GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - codebit-hub/Exam04: Python exam at Orbit 4

BranchesTags
Open more actions menu

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
Level1
Level1
 
 
Level2
Level2
 
 
Level3
Level3
 
 
Level4
Level4
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 

Repository files navigation

This project has been created as part of the 42 curriculum by dporhomo

42 School Grade Python Date

Exam 04: Python Algorithmic Challenges

The core constraint of this exam was to solve complex algorithmic problems using pure, procedural Pythonβ€”strictly avoiding external imports, advanced built-in functions (like collections, itertools, or math), and relying entirely on fundamental loops, list manipulations, and manual state tracking.

πŸ“‚ Repository Structure

.
β”œβ”€β”€ Level1
β”‚   β”œβ”€β”€ array_rotation_detector.py
β”‚   └── constellation_mapper.py
β”œβ”€β”€ Level2
β”‚   β”œβ”€β”€ list_intersection_finder.py
β”‚   └── merge_sorted_lists.py
β”œβ”€β”€ Level3
β”‚   β”œβ”€β”€ package_dependency_resolver.py
β”‚   β”œβ”€β”€ package_dependency_resolver_clean.py
β”‚   β”œβ”€β”€ package_dependency_resolver_program.py
β”‚   └── palindrome_partitioner.py
└── Level4
    └── sliding_window_maximum.py


πŸ“ Exercise Descriptions

Level 1

  • array_rotation_detector.py: An algorithm to determine the number of times a sorted array has been rotated, or to find the pivot point in a shifted sequence.
  • constellation_mapper.py: A grid/matrix traversal algorithm to identify and map connected components (constellations) within a 2D space.

Level 2

  • list_intersection_finder.py: A memory-efficient solution to find common elements (intersections) between two lists with and without relying on Python's built-in set operations.
  • merge_sorted_lists.py: Implements the merging phase of Merge Sort. It takes two pre-sorted lists and combines them into a single sorted list strictly using pointer manipulation.

Level 3

  • package_dependency_resolver*.py: A procedural implementation of Kahn's Algorithm for Topological Sorting. It resolves software dependencies by processing packages in "waves." It ensures that independent packages are processed in strict alphabetical order without relying on standard queue libraries like collections.deque. The _program.py version includes a CLI wrapper to parse JSON input from sys.argv.
  • palindrome_partitioner.py: A Dynamic Programming (DP) solution that calculates the minimum number of cuts required to partition a string such that every resulting substring is a valid, case-sensitive palindrome. It uses a 1D DP array to memoize optimal cuts and avoid redundant checks.

Level 4

  • sliding_window_maximum.py: Calculates the maximum element in every sliding window of size k across an array. Handles all edge cases (empty arrays, zero size, window larger than array) and manually calculates maximums within sliced subarrays to strictly adhere to the "no built-in functions" rule.

πŸš€ Instructions

Ensure you have Python 3.13 installed. Since these are pure Python scripts with no external dependencies, they can be executed directly from the terminal.

Running standard functions

For most scripts, simply execute the file to run the embedded test cases:

python3 Level4/sliding_window_maximum.py
python3 Level3/palindrome_partitioner.py

Running CLI-enabled programs

For scripts designed to take command-line arguments (like the dependency resolver program), pass the required JSON string as an argument:

# Example with package dependency resolver
python3 Level3/package_dependency_resolver_program.py '{"app": ["database"], "database": ["driver"], "driver": []}'

*Expected Output: driver database app*

If run without arguments, the script will default to running a suite of built-in test cases for validation:

python3 Level3/package_dependency_resolver_program.py

About

Python exam at Orbit 4

Topics

4242cursusdynamic-programmingexam04orbit-4package-dependency-resolverpythontopological-sort

Resources

Readme
Activity

Stars

3 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.