Anambra's #1 Tech Innovation Hub

What will you
build next?

1542+
Students Trained
97%
Completion Rate
124+
Projects Built
Tekhub NG Tekhub NG Tekhub NG Tekhub NG Tekhub NG

Search Register
Practice

Code Challenges

Pick a category from our real course catalog, read the challenge, then write and run your solution right here in the embedded compiler. No setup, no signup, just code.

Choose a category

Based on our full-stack, backend, and framework tracks.

  • Palindrome CheckEasy
    Check whether a string reads the same forwards and backwards.

    Write a function isPalindrome(str) that returns true if a string reads the same forwards and backwards, ignoring case, spaces, and punctuation.

    Example: isPalindrome("A man a plan a canal Panama") should return true.

  • Group by StatusMedium
    Bucket a list of API response objects by their status field.

    Given an array of API response objects like { id: 1, status: "ok" }, write a function groupByStatus(responses) that returns an object mapping each distinct status to an array of the matching response objects.

  • DebounceMedium
    Delay a function call until the caller stops firing events.

    Implement a debounce(fn, delay) function that returns a new function which only calls fn after delay milliseconds have passed since the last time the returned function was invoked.

    This is the pattern behind a live search box that shouldn't fire a request on every keystroke.

  • Route MatcherHard
    Match a URL path against an Express-style route pattern.

    Given a route pattern like /users/:id/posts/:postId and an actual path like /users/42/posts/7, write a function matchRoute(pattern, path) that returns an object of extracted parameters (e.g. { id: "42", postId: "7" }), or null if the path doesn't match the pattern's shape.

Based on our data science and machine learning tracks.

  • Above AverageEasy
    Filter a list down to values above its own average.

    Write a function above_average(numbers) that returns a new list containing only the values from numbers that are greater than the average of the whole list.

  • Fill the GapsMedium
    Interpolate missing sensor readings from their neighbors.

    Given a list of numeric readings where missing values are represented as None (e.g. [20, None, 24, None, None, 30]), write a function fill_gaps(readings) that replaces each None with the average of its nearest non-None neighbor on each side. Assume the first and last readings are never None.

  • Stats From ScratchMedium
    Compute mean, median, and standard deviation by hand.

    Write a function describe(numbers) that returns the mean, median, and standard deviation of a list of numbers, computed manually without importing any statistics library.

  • K-Nearest NeighborsHard
    Classify a new point from labeled training data.

    Write a function knn_predict(training_data, point, k) where training_data is a list of (features, label) tuples. Return the predicted label for point by finding the k closest training points using Euclidean distance and taking a majority vote among their labels.

Based on our prompt engineering & automation track.

  • Word FrequencyEasy
    Count how often each word appears in a block of text.

    Write a function word_frequency(text) that returns a dictionary mapping each word in text to how many times it appears, ignoring case and punctuation.

  • Rule-Based Reply BotMedium
    Return a canned response based on keyword matching.

    Write a function reply(message) that inspects a user's message for keywords (for example "hello", "price", "bye") and returns an appropriate canned response for the first keyword it matches, or a generic fallback response if none match.

  • Greedy Task SchedulerMedium
    Fit the highest-priority automation tasks into a time budget.

    Given a list of tasks, each with a name, duration, and priority, and a total time_budget, write a function schedule(tasks, time_budget) that greedily selects tasks, highest priority first, that still fit within the remaining budget, and returns the list of chosen task names.

  • Token Bucket Rate LimiterHard
    Throttle requests to a workflow automation with a token bucket.

    Implement a TokenBucket class with a constructor TokenBucket(capacity, refill_rate) and a method allow_request() that returns True if a request can proceed, consuming one token, and False if the bucket is empty, refilling tokens over time based on refill_rate tokens per second.

Based on our ethical hacking & cybersecurity track.

  • Password Strength CheckEasy
    Validate a password against basic strength rules.

    Write a function is_strong_password(password) that returns True only if the password is at least 8 characters long and contains at least one digit, one uppercase letter, one lowercase letter, and one special character.

  • Caesar CipherMedium
    Encrypt and decrypt text with a classic shift cipher.

    Write two functions, caesar_encrypt(text, shift) and caesar_decrypt(text, shift), that shift each letter in text forward or backward by shift positions in the alphabet, preserving letter case and leaving non-letter characters unchanged.

  • Simple XSS Pattern DetectorMedium
    Flag suspicious substrings often seen in XSS payloads.

    Write a function contains_xss_pattern(input_str) that returns True if the input contains any of a small known list of suspicious substrings commonly seen in XSS attacks (for example <script, onerror=, javascript:), checked case-insensitively.

  • Luhn Checksum ValidatorHard
    Validate a card-style number against the Luhn algorithm.

    Write a function is_valid_luhn(number_str) that validates a numeric string, such as a card number, against the Luhn algorithm: starting from the rightmost digit, double every second digit, subtract 9 from any doubled result over 9, sum all the digits, and check that the total is divisible by 10.

Based on our robotics, hardware, IoT, and MATLAB/C tracks.

  • Celsius to FahrenheitEasy
    Convert a sensor's Celsius reading to Fahrenheit.

    Write a function celsiusToFahrenheit(c) that converts a Celsius temperature to Fahrenheit and returns the result rounded to 1 decimal place.

  • Sensor SmoothingMedium
    Smooth noisy sensor readings with a moving average.

    Write a function movingAverage(readings) that applies a simple moving average with a window size of 3 to an array of sensor readings, returning a new smoothed array of the same length (readings near the edges can average over however many neighboring values are available).

  • PID Controller StepMedium
    Compute one control-loop step of a PID controller.

    Write a function pidStep(error, prevError, integral, kp, ki, kd) that computes one step of a PID controller: add error to integral, compute derivative = error - prevError, then return the control output kp*error + ki*integral + kd*derivative.

  • Traffic Light State MachineHard
    Advance a traffic light through its RED/GREEN/YELLOW cycle.

    Write a function nextState(state, elapsed) that simulates a traffic light cycling RED (5s) → GREEN (4s) → YELLOW (2s) → RED. Given the current state and the elapsed seconds spent in that state, return the next state name once elapsed time meets or exceeds the current state's duration, otherwise return the same state unchanged.

Web Development

Palindrome Check

Easy

Write a function isPalindrome(str) that returns true if a string reads the same forwards and backwards, ignoring case, spaces, and punctuation.

Example: isPalindrome("A man a plan a canal Panama") should return true.

Powered by OneCompiler, no signup required