Jump to content

Programming Challenges

Test your skills with coding challenges, discuss algorithms, and share solutions.

  1. 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
    • 64 views
  2. 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
    • 88 views
  3. 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
    • 80 views
  4. 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
    • 76 views
  5. 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
    • 58 views
  6. 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
    • 68 views
  7. 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
    • 58 views
  8. 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…

  9. 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 …

  10. 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…

  11. 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…

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.