Search
Register
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.
Based on our full-stack, backend, and framework tracks.
-
Palindrome CheckEasyCheck whether a string reads the same forwards and backwards.
Write a function
isPalindrome(str)that returnstrueif a string reads the same forwards and backwards, ignoring case, spaces, and punctuation.Example:
isPalindrome("A man a plan a canal Panama")should returntrue. -
Group by StatusMediumBucket a list of API response objects by their status field.
Given an array of API response objects like
{ id: 1, status: "ok" }, write a functiongroupByStatus(responses)that returns an object mapping each distinct status to an array of the matching response objects. -
DebounceMediumDelay a function call until the caller stops firing events.
Implement a
debounce(fn, delay)function that returns a new function which only callsfnafterdelaymilliseconds 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 MatcherHardMatch a URL path against an Express-style route pattern.
Given a route pattern like
/users/:id/posts/:postIdand an actual path like/users/42/posts/7, write a functionmatchRoute(pattern, path)that returns an object of extracted parameters (e.g.{ id: "42", postId: "7" }), ornullif the path doesn't match the pattern's shape.
Based on our data science and machine learning tracks.
-
Above AverageEasyFilter a list down to values above its own average.
Write a function
above_average(numbers)that returns a new list containing only the values fromnumbersthat are greater than the average of the whole list. -
Fill the GapsMediumInterpolate 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 functionfill_gaps(readings)that replaces eachNonewith the average of its nearest non-None neighbor on each side. Assume the first and last readings are neverNone. -
Stats From ScratchMediumCompute 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 NeighborsHardClassify a new point from labeled training data.
Write a function
knn_predict(training_data, point, k)wheretraining_datais a list of(features, label)tuples. Return the predicted label forpointby finding thekclosest training points using Euclidean distance and taking a majority vote among their labels.
Based on our prompt engineering & automation track.
-
Word FrequencyEasyCount how often each word appears in a block of text.
Write a function
word_frequency(text)that returns a dictionary mapping each word intextto how many times it appears, ignoring case and punctuation. -
Rule-Based Reply BotMediumReturn 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 SchedulerMediumFit the highest-priority automation tasks into a time budget.
Given a list of tasks, each with a
name,duration, andpriority, and a totaltime_budget, write a functionschedule(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 LimiterHardThrottle requests to a workflow automation with a token bucket.
Implement a
TokenBucketclass with a constructorTokenBucket(capacity, refill_rate)and a methodallow_request()that returnsTrueif a request can proceed, consuming one token, andFalseif the bucket is empty, refilling tokens over time based onrefill_ratetokens per second.
Based on our ethical hacking & cybersecurity track.
-
Password Strength CheckEasyValidate a password against basic strength rules.
Write a function
is_strong_password(password)that returnsTrueonly 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 CipherMediumEncrypt and decrypt text with a classic shift cipher.
Write two functions,
caesar_encrypt(text, shift)andcaesar_decrypt(text, shift), that shift each letter intextforward or backward byshiftpositions in the alphabet, preserving letter case and leaving non-letter characters unchanged. -
Simple XSS Pattern DetectorMediumFlag suspicious substrings often seen in XSS payloads.
Write a function
contains_xss_pattern(input_str)that returnsTrueif 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 ValidatorHardValidate 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 FahrenheitEasyConvert 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 SmoothingMediumSmooth 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 StepMediumCompute 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: adderrortointegral, computederivative = error - prevError, then return the control outputkp*error + ki*integral + kd*derivative. -
Traffic Light State MachineHardAdvance a traffic light through its RED/GREEN/YELLOW cycle.
Write a function
nextState(state, elapsed)that simulates a traffic light cyclingRED(5s) →GREEN(4s) →YELLOW(2s) →RED. Given the currentstateand theelapsedseconds 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.
Palindrome Check
EasyWrite 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.