Programming Challenges
Test your skills with coding challenges, discuss algorithms, and share solutions.
36 topics in this forum
-
Objective Write a program that simulates an interactive text-based adventure game. The player must navigate through a series of challenges, make decisions, and reach the treasure at the end of the journey. The program should provide multiple paths and outcomes based on the player's choices. Requirements Input Handling: The program should take user input to make decisions (e.g., choosing between different paths or actions). Dynamic Storyline: Create at least three branches in the story with unique outcomes based on user decisions. Data Structures: Use appropriate data structures to manage the game's state (e.g., dictionaries for story branches, …
-
- 1 reply
- 117 views
-
-
Objective: Create a program that generates custom holiday messages by combining templates and user input. The program should also allow the user to shuffle the words for fun. Requirements: The program should provide a set of predefined holiday message templates, such as: "Happy {holiday}, {name}! May your {wish} come true this season!" "Wishing you a {adjective} {holiday}, {name}. Stay {wish} and joyful!" The program must: Ask the user for inputs like the holiday name, their name, an adjective, and a wish. Fill the templates with the user-provided data. Display the fina…
-
- 1 reply
- 135 views
-
-
Objective Build a simple chatbot in a programming language of your choice. The bot should respond contextually to user inputs and include a unique personality or theme. Requirements Personality/Theme: Define the chatbot’s personality or theme (e.g., a sarcastic movie critic, a helpful librarian, or a medieval knight offering advice). Context Awareness: The chatbot should remember at least two pieces of information shared by the user and reference them later in the conversation. Responses: Include at least 10 unique responses based on keywords, context, or a combination o…
-
- 1 reply
- 129 views
-
-
Challenge:Design and implement a basic adaptive MFA system that enhances security while minimizing friction for users. The system should prompt for MFA only when risk factors are detected (e.g., logging in from a new device, unusual location, or repeated failed login attempts). Basic Requirements:✅ Implement user authentication with a username and password. ✅ Implement MFA using a One-Time Password (OTP) (via email, SMS, or authenticator app). ✅ Introduce risk-based authentication, triggering MFA only when certain conditions are met (e.g., new IP, failed login attempts). Bonus Features for Enterprise-Level Security:🔹 Device Fingerprinting: Store known devices and only req…
-
- 0 replies
- 70 views
-
-
Challenge:Design and implement an API rate-limiting system that prevents abuse and ensures fair usage of enterprise APIs. The system should allow different rate limits based on user roles (e.g., Free, Premium, Admin) and IP addresses. Basic Requirements:✅ Implement request counting to track API usage per user/IP. ✅ Set rate limits (e.g., 100 requests per minute for Free users, 1,000 for Premium). ✅ Block or throttle users exceeding their limit. ✅ Use an in-memory store (e.g., Redis, Python Dictionary) to track API usage. Bonus Features for Enterprise-Grade Security:🔹 Role-Based Rate Limits: Different limits for Free, Premium, and Admin users. 🔹 Sliding Window Algorithm: P…
-
- 0 replies
- 67 views
-
-
Challenge:Design and implement a basic Service Mesh that manages microservices communication within an enterprise architecture. The system should ensure secure, observable, and resilient service-to-service interactions. Basic Requirements:✅ Implement service-to-service communication using an API gateway or service proxy. ✅ Enable basic request routing between multiple microservices. ✅ Implement health checks to monitor service availability. Bonus Features for Enterprise-Grade Implementation:🔹 Traffic Control & Load Balancing: Distribute requests intelligently between services. 🔹 Security & Encryption: Implement mutual TLS (mTLS) for secure service-to-service commu…
-
- 0 replies
- 69 views
-
-
Challenge:Build a container security scanner that analyzes Docker images for vulnerabilities and misconfigurations. The system should check for outdated packages, excessive privileges, and potential security risks inside the container. Basic Requirements:✅ Scan a Docker image for known vulnerabilities. ✅ Identify and flag outdated dependencies. ✅ Detect privileged containers (running as root). Bonus Features for Enterprise-Grade Security:🔹 Integrate CVE Database: Use Trivy, Clair, or Grype to detect vulnerabilities. 🔹 Policy Enforcement: Block deployment of insecure images. 🔹 Runtime Security Checks: Monitor running containers for suspicious activity. 🔹 SBOM (Software Bil…
-
- 0 replies
- 76 views
-
-
Challenge: Create a RESTful API that serves inspirational quotes. The API should allow users to: Fetch a random quote Fetch a quote by ID Add a new quote Requirements: Use any programming language or framework (e.g., Python with Flask, Node.js with Express, etc.). Store the quotes in a file (JSON, text, or CSV) or a database. Return responses in JSON format. Bonus Points: Implement authentication for adding a new quote. Include a search endpoint to find quotes by keyword. Deploy your API using a lightweight server manager like PM2 or Docker. Example Endpoints: GET /quote/random - Retur…
-
- 0 replies
- 131 views
-
-
Challenge:Build a simple time tracking system that allows small businesses or freelancers to log work hours for projects and generate basic reports. Basic Requirements:✅ Start and Stop Tracking: Users can start and stop a work session. ✅ Project-Based Logging: Assign time entries to specific projects or clients. ✅ Daily & Weekly Reports: Summarize hours worked per project. Bonus Features for Small Business Needs:🔹 Invoice Generation: Convert time logs into invoices for clients. 🔹 CSV/Excel Export: Allow users to export time reports. 🔹 User Authentication: Let multiple users track their own hours. 🔹 Idle Time Detection: Automatically detect inactivity. 🔹 Mobile-Friendl…
-
- 0 replies
- 68 views
-
-
Objective Build a mini weather dashboard using a programming language and framework of your choice. The dashboard should display current weather information for at least one location. Requirements Weather Data: Fetch live weather data using a public API (e.g., OpenWeatherMap or WeatherAPI). User Input: Allow the user to input a city name or ZIP code to get the weather details. Display: Present key information like temperature, weather condition (e.g., sunny, rainy), and wind speed in a clean format. Error Handling: Handle errors graceful…
-
- 0 replies
- 103 views
-
-
Objective Implement a pathfinding algorithm (e.g., Dijkstra’s or A*) to find the shortest path between two points on a grid. Requirements Grid Representation: Create a 2D grid where each cell represents walkable terrain or an obstacle. Algorithm: Implement a pathfinding algorithm like Dijkstra’s or A*. The algorithm should find the shortest path between a start and an end point, avoiding obstacles. Visualization: Print the grid showing the path taken. For example: S for start E for end X for obstacles …
-
- 0 replies
- 111 views
-
-
Objective Build a countdown timer that counts down to midnight on New Year's Eve. Once the timer hits zero, display a celebratory animation or message. Requirements Timer Functionality: The countdown should accurately show the time left (in days, hours, minutes, and seconds) until midnight on New Year’s Eve. User Timezone: Account for the user’s local timezone to ensure accuracy. Celebration Effect: Display a festive animation or message when the timer hits zero (e.g., fireworks, confetti, or a celebratory sound). Language/Framework: Use…
-
- 0 replies
- 118 views
-
-
Write a program that calculates the Nth Fibonacci number. The Fibonacci sequence is defined as follows: F(0) = 0 F(1) = 1 F(n) = F(n-1) + F(n-2) for n > 1 Requirements: Allow the user to input the value of N. Implement the program in two ways: Using recursion. Using iteration (for efficiency with larger N). Optimize the recursive solution with memoization or dynamic programming to handle larger values of N. Bonus: Print the time taken by both methods to compute the result for comparison. Example Output: For N = 10, the result should be 55.
-
- 0 replies
- 69 views
-
-
Challenge: Write a program that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or sequence of characters that reads the same backward as forward, ignoring spaces, punctuation, and capitalization. Requirements: Accept user input for the string. Normalize the string by removing non-alphanumeric characters and converting it to lowercase. Check if the normalized string is a palindrome. Print True or False based on the result. Bonus: Extend the program to handle numeric palindromes (e.g., 12321). Allow the user to check multiple strings in one run. Example Output: Input: "A m…
-
- 0 replies
- 80 views
-
-
Write a program that reads a server log file and analyzes it to provide the following information: The total number of requests. The top 5 IP addresses making requests. The most requested resource (URL). The number of 4xx and 5xx error codes encountered. Bonus: Add a feature to identify failed login attempts by looking for specific patterns like "login failed" or "authentication error." Allow the user to input the path to the log file. Example Output: Total Requests: 12,345 Top 5 IPs: 1. 192.168.1.1 - 1,234 requests 2. 10.0.0.5 - 987 requests ... Most Requested Resource: /index.html 4xx Errors: 456 5xx Errors: 123
-
- 0 replies
- 69 views
-
-
Write a program that checks the strength of a password based on the following criteria: Password Strength Rules: Must be at least 8 characters long. Must contain at least one uppercase letter. Must contain at least one lowercase letter. Must contain at least one number. Must contain at least one special character (e.g., !@#$%^&*()). Program Requirements: Accept user input for the password. Check the password against the rules and rate it as: Weak if it meets 1-2 rules. Moderate if it meets 3-4 rules. Strong if it meets all 5 rules. Provide feedback to the user on wha…
-
- 0 replies
- 84 views
-
-
Create a command-line to-do list application that allows users to manage their tasks. The app should have the following functionality: Basic Features: Add a new task with a description. Mark a task as complete. Delete a task by its ID. List all tasks, showing their status (e.g., completed or pending). Bonus Features: Add due dates to tasks. Allow users to edit tasks. Save tasks to a file so they persist between runs. Example Output: Welcome to the To-Do List App! 1. Add Task 2. Complete Task 3. Delete Task 4. View Tasks 5. Exit Enter your choice: 1 Enter task description: Complete the Programming Challenge T…
-
- 0 replies
- 95 views
-
-
Write a BASH script that performs a backup of a specified directory to a target location. The script should include the following functionality: Basic Requirements: Accept two arguments: Source directory Target backup location Verify that both the source and target locations exist. Create a timestamped backup folder in the target location. Log the backup process, including the time taken and the number of files backed up. Bonus Features: Implement compression (e.g., using tar or zip) for the backup. Add error handling to catch issues like missing arguments or permission errors. Allow for…
-
- 0 replies
- 98 views
-
-
Build a URL shortener that converts a long URL into a short one and allows users to retrieve the original URL from the shortened version. Basic Requirements: Accept a long URL as input and return a shortened URL. Store the mapping between the long and short URLs. Accept a shortened URL as input and return the original long URL. Bonus Features: Use a hashing algorithm to generate the short URL. Add error handling to check if the input URL is valid. Implement file-based persistence so the mapping is saved between runs. Example Output: Enter a long URL: https://codenamejessica.com/forums/forum/9-programming-challenges …
-
- 0 replies
- 74 views
-
-
Challenge: Create a command-line calculator that performs basic arithmetic operations and keeps a history of calculations during the session. Basic Requirements: Allow the user to perform addition, subtraction, multiplication, and division. Accept input in the format: number operator number (e.g., 5 + 3). Display the result of each calculation. Store the history of calculations in a list and display it upon request. Bonus Features: Add support for more complex operations like square roots, exponents, and percentages. Implement input validation to handle errors (e.g., dividing by zero). Allow the user to save the …
-
- 0 replies
- 76 views
-
-
Today, I think it will be an easy one. Write a program that validates IPv4 and IPv6 addresses. Basic Requirements: Accept a string input from the user. Check if the input is a valid IPv4 address (e.g., 192.168.1.1). Check if the input is a valid IPv6 address (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334). Print whether the address is valid, and if so, specify the type (IPv4 or IPv6). Bonus Features: Detect private IP ranges for IPv4. Handle CIDR notation (e.g., 192.168.1.0/24). Identify loopback addresses (e.g., 127.0.0.1 for IPv4, ::1 for IPv6). Example Output: Enter an IP address: 192.168.1.1 Valid IPv4 add…
-
- 0 replies
- 108 views
-
-
Write a program that automatically organizes files in a directory by file type. The program should: Basic Requirements:Scan a directory for files. Create folders for different file types (e.g., Documents, Images, Videos). Move files into their respective folders based on their extensions. Bonus Features:Allow the user to specify the directory to organize. Include an undo option to restore files to their original locations. Add a custom ruleset that allows users to specify how files should be categorized (e.g., .py files go to Scripts). Example Output:Enter the directory to organize: /home/user/Downloads Organizing files... Files organized successfully: - Documents: 12 fil…
-
- 0 replies
- 95 views
-
-
Write a program that checks whether a given number is a palindrome. A palindrome number reads the same backward as forward (e.g., 121, 12321). Basic Requirements:Accept numeric input from the user. Check if the number is a palindrome. Display True if it’s a palindrome and False otherwise. Bonus Features:Extend the program to check binary representations of the number for palindromic properties. Add the ability to handle negative numbers (e.g., -121 should return False). Allow users to check multiple numbers in one run. Example Output:Enter a number: 12321 True (It's a palindrome!) Enter a number: 12345 False (Not a palindrome) Enter a number: 9 True (It's a palindrome!)
-
- 0 replies
- 98 views
-
-
Write a program that implements a Caesar Cipher, one of the simplest encryption techniques. The program should be able to both encrypt and decrypt text using a given shift value. Basic Requirements:Accept a message from the user. Accept a shift value (e.g., 3 shifts each letter forward by 3). Provide options to encrypt or decrypt the message. Handle both uppercase and lowercase letters. Bonus Features:Handle non-alphabetic characters by leaving them unchanged. Allow the user to brute-force decrypt a message by trying all possible shift values. Implement a case-insensitive mode to ignore letter casing in the input. Example Output:Choose an option: (1) Encrypt (2) Decrypt &…
-
- 0 replies
- 95 views
-
-
Let's start with a classic! I wanted to create a simple challenge for kids or beginners just starting out with programming. FizzBuzz is one of the most basic challenges you'll encounter, but it's also a great way to practice loops and conditions. Hint: You can only % so much... after that, it’s all about $. 😉 Have fun coding, and don’t forget to share your twist on the solution! Write a program that implements the classic FizzBuzz game with an additional twist: Basic Requirements:For numbers from 1 to 100: Print "Fizz" if the number is divisible by 3. Print "Buzz" if the number is divisible by 5. Print "FizzBuzz" if the number is divisible by both 3 and 5. Print the numb…
-
- 0 replies
- 115 views
-