Back to Sloplang

Practice Problems

Test your Sloplang skills. Each problem provides variables and validates your output against test cases.

1
Two SumEasy

Given a list of numbers and a target, find the two numbers that add up to the target. Print them as a list [a, b] where a appears before b in the original list.

3 tests
2
FizzBuzzEasy

For each number from 1 to n, print "Fizz" if it's divisible by 3, "Buzz" if divisible by 5, "FizzBuzz" if divisible by both, or the number itself otherwise. Print each result on its own line.

2 tests
3
Valid ParenthesesEasy

Given a string containing only the characters (, ), {, }, [, and ], determine if the input string is valid. A string is valid if open brackets are closed by the same type in the correct order. Print true or false.

4 tests
4
Palindrome CheckEasy

Given a string, determine if it is a palindrome (reads the same forwards and backwards). Print true or false.

3 tests
5
Most Common CharacterMedium

Given a string, find the character that appears most often. Print the character and its count separated by a colon and space, like "a: 5". If there's a tie, any of the most common is fine.

2 tests
6
Number Transform PipelineMedium

Given a list of numbers, solve two parts:

2 tests
7
Calorie CountingMedium

Elves carry food items, each with a calorie count. Each elf's inventory is a group of numbers separated by blank lines.

2 tests
8
Log ParserMedium

Parse a log file where each line has a timestamp, level, and message separated by | characters.

2 tests
9
Running AverageMedium

Given a list of numbers and a window size k, compute the running average over each window of k consecutive elements. Print the results as a list of integers (use integer division).

2 tests
10
Group AnagramsHard

Given a list of words, group the anagrams together. Print each group as a list on its own line, with groups sorted by their first element, and words within each group sorted alphabetically.

2 tests

You are not logged in.