w3resource

Daily Coding Challenges & Projects


Monday


Frontend Mini Project Challenge

JavaScript Logical Puzzles & Debugging

Challenge 1 : JavaScript Puzzle – Flatten an Array (Without Recursion)

Write a function flattenArray(arr) to flatten a deeply nested array without using recursion.

Example Input: [1, [2, [3, 4], 5], 6]

Expected Output: [1, 2, 3, 4, 5, 6]

Hint: Use a stack to simulate recursion.


Challenge 2: JavaScript Debugging


const nums = [1, 2, 3];
const doubled = nums.map(num => {
  return num * 2;
}, this);
console.log(doubled);

Bug : Why does this code need this?

Fix it and explain what this is doing.


Interactive Playground : JSFiddle or CodePen

Backend Challenge

Language Focus : C++

Challenges :

Reverse a Singly Linked List in-place without using extra memory, and display the list in reverse without modifying the original list structure.

Task :

  1. Implement a function to reverse a singly linked list in-place (iteratively).
  2. Implement another function that prints the list in reverse without modifying the original list or using recursion (hint: use a stack manually or simulate it with a loop).
  3. Handle edge cases like an empty list and a single-node list.

Bonus Challenge:

  • Implement both versions: one using an in-place reversal (for actual reversal), and another that simply prints in reverse order without reversing.
  • Ensure your functions are memory-efficient (no STL containers like std::vector allowed in the reverse-print version).

Database Query Challenge

Problems on SQL - HR Database :

  1. Write a SQL query to find the top 5 departments with the highest average salary. Return: department_id, average_salary, and order the result in descending order.
  2. Write a SQL query to find employees who report to the same manager and are in the same job role. Return: manager_id, job_id, COUNT(*) as total_employees, and only include groups with more than 2 employees.
Structure of HR database :

HR database



Data Structures & Algorithms Challenge

  • Easy:
    • Problem: Find the missing number in an array containing numbers from 1 to N with one number missing.
    • Hint: Use the formula N*(N+1)/2 and subtract actual sum.
  • Medium:
    • Problem: Implement a stack using two queues.
    • Hint: Use costly push() or pop() depending on the approach.
  • Hard:
    • Problem: Given a string, find the length of the longest substring without repeating characters.
    • Hint: Use sliding window + hashmap.

Bug of the Day

Language Focus : C/C++/C#

Language: C

    Buggy Code:

    
    #include 
    
    int main() {
        int a = 10, b = 0;
        int c = a / b;
        printf("%d\n", c);
        return 0;
    }
    

Challenge :

  • What’s the bug?
  • How would you handle division by zero safely in C?

📋 Daily Micro-Project

Frontend :

Challenge :

Create a CSS-only animated loading spinner. It should rotate continuously using @keyframes.

Tools :

Try using CodePen or JSFiddle

Trivia: 5 Fun Facts

  1. The first computer bug was a literal moth found in a computer in 1947.
  2. Java was originally called “Oak.”
  3. Python is named after Monty Python’s Flying Circus, not the snake.
  4. The first version of Windows was released in 1985.
  5. Git was created by Linus Torvalds in 2005 for Linux kernel development.

Tool & Resource of the Day

Tool : CodeSandbox

    Online IDE for rapid prototyping in JavaScript/React.

Interview Question of the Day

Daily Interview Questions

    Frontend :
    1. What is the difference between null and undefined in JavaScript?
    2. Explain how the event delegation pattern works in JavaScript.
    3. How does the Virtual DOM work in React, and why is it useful?
    4. What are the key differences between Vue.js computed properties and watchers?
    Backend :
    1. What’s the difference between synchronous and asynchronous programming in Node.js?
    2. Explain threads vs. processes.
    3. How does memory management work in Python?
    4. RESTful API vs. GraphQL – Compare and contrast.
    Database :
    1. What is the difference between INNER JOIN and LEFT JOIN?
    2. How do indexes improve SQL performance?
    3. Compare NoSQL vs. SQL databases.
    Others :
    1. What are system calls in OS?
    2. What is containerization, and how does Docker help?

Daily Quiz Challenge

    Frontend ( JavaScript ) :

    1. What is the output of console.log([] + []);
      • [ ]
      • ""
      • undefined
      • object
    2. Which event runs when the DOM is fully loaded?
      • onload
      • DOMContentLoaded
      • ready
      • load
    3. What is the correct way to add a class in vanilla JS?
      • element.addClass("myClass")
      • element.classList.add("myClass")
      • element.className += "myClass"
      • element.appendClass("myClass")

    Backend ( C, C++, C# ) :

    1. Which of these is not a valid C storage class?
      • auto
      • register
      • public
      • static
    2. How is memory deallocated in C++?
      • delete
      • free
      • remove
      • dispose
    3. What is the purpose of using namespace std; in C++?
      • To use built-in C libraries
      • To avoid writing std:: prefix
      • To define a class
      • None of the above

    Others :

    1. What is the default sort order of ORDER BY?
      • ASC
      • DESC
      • Random
      • None
    2. What does ps aux do in Linux?
      • Shows process list
      • Displays current directory
      • Shows memory usage
      • Updates packages

Weekly Cross-Domain Activities ( May 09 to May 15, 2025 )

API of the Day:

NASA Astronomy Picture of the Day (APOD) — Use NASA's APOD API to fetch the image or video of the day along with its description, and display it in a simple UI.

Challenge :

Build a gallery-style viewer where users can:

  • See today’s image
  • Browse previous days using a calendar or buttons
  • Read accompanying explanations

Resource:

Linux/DevOps Tip :

Monitor disk I/O and performance using iotop, sar, and glances

Commands to Explore :

  • iotop – Monitor real-time I/O usage by processes
  • sar – Collect, report, or save system activity information
  • glances – A cross-platform monitoring tool with an elegant web UI

Real-World Project of the Week ( May 09 to May 15, 2025 )

Project of the Week:

    Build a Budget Tracker Web App — Develop a web-based expense tracker where users can:

    • Add, categorize, and delete transactions
    • View monthly summaries and pie charts
    • Store data locally or connect to a backend for persistence

Tech Stack : HTML, CSS, JavaScript (with Chart.js for graphs)

Collaborative Project:

    Join the First Contributions GitHub Project — Learn how to make your first open-source pull request and contribute to beginner-friendly repositories with guided instructions.

Case Study:

    Explore Trello's Task Management UI — Analyze how Trello manages drag-and-drop task organization with React and libraries like react-beautiful-dnd.

Challenge :

Try building a minimal Kanban board with drag-and-drop cards and persistent state.


Previous Daily Coding Challenges & Projects : 04-04-2025   07-04-2025  08-04-2025  09-04-2025  10-04-2025  11-04-2025  14-04-2025  15-04-2025  16-04-2025  17-04-2025  18-04-2025  21-04-2025  22-04-2025  23-04-2025  24-04-2025  25-04-2025  28-04-2025  29-04-2025  30-04-2025  01-05-2025  02-05-2025  05-05-2025  06-05-2025  07-05-2025  08-05-2025  09-05-2025



Follow us on Facebook and Twitter for latest update.