Daily Coding Challenges & Projects
Monday
Frontend Challenge
JavaScript Logical Puzzle
Challenge: Write a function to flatten a nested array without using recursion.
Example:
console.log(flatten([1, [2, [3, 4], 5], 6]));
// Output: [1, 2, 3, 4, 5, 6]
Hint: Use a loop and a stack (or a queue) to process elements.
Backend Challenge
Problem: Reverse a linked list in C/C++/C#.
- Implement a function that takes a linked list and returns it reversed.
- Optimize for both iterative and recursive solutions.
Database Query Challenge
Problem:Write a SQL query to find all employees who joined in the last 3 months.
Hint: Use DATE_ADD() or INTERVAL in your query.
Sample table: employees+-------------+-------------+-------------+----------+--------------------+------------+------------+----------+----------------+------------+---------------+ | EMPLOYEE_ID | FIRST_NAME | LAST_NAME | EMAIL | PHONE_NUMBER | HIRE_DATE | JOB_ID | SALARY | COMMISSION_PCT | MANAGER_ID | DEPARTMENT_ID | +-------------+-------------+-------------+----------+--------------------+------------+------------+----------+----------------+------------+---------------+ | 100 | Steven | King | SKING | 515.123.4567 | 2003-06-17 | AD_PRES | 24000.00 | 0.00 | 0 | 90 | | 101 | Neena | Kochhar | NKOCHHAR | 515.123.4568 | 2005-09-21 | AD_VP | 17000.00 | 0.00 | 100 | 90 | | 102 | Lex | De Haan | LDEHAAN | 515.123.4569 | 2001-01-13 | AD_VP | 17000.00 | 0.00 | 100 | 90 | | 103 | Alexander | Hunold | AHUNOLD | 590.423.4567 | 2006-01-03 | IT_PROG | 9000.00 | 0.00 | 102 | 60 | | 104 | Bruce | Ernst | BERNST | 590.423.4568 | 2007-05-21 | IT_PROG | 6000.00 | 0.00 | 103 | 60 | | 105 | David | Austin | DAUSTIN | 590.423.4569 | 2005-06-25 | IT_PROG | 4800.00 | 0.00 | 103 | 60 | | 106 | Valli | Pataballa | VPATABAL | 590.423.4560 | 2006-02-05 | IT_PROG | 4800.00 | 0.00 | 103 | 60 | | 107 | Diana | Lorentz | DLORENTZ | 590.423.5567 | 2007-02-07 | IT_PROG | 4200.00 | 0.00 | 103 | 60 | | 108 | Nancy | Greenberg | NGREENBE | 515.124.4569 | 2002-08-17 | FI_MGR | 12008.00 | 0.00 | 101 | 100 | | 109 | Daniel | Faviet | DFAVIET | 515.124.4169 | 2002-08-16 | FI_ACCOUNT | 9000.00 | 0.00 | 108 | 100 | .......
Data Structures & Algorithms Challenge
- Easy: Find the first non-repeating character in a string.
- Hint: Use a hash map to store character counts.
- Medium: Implement binary search on a rotated sorted array.
- Hint: Modify standard binary search logic to handle rotation.
- Hard: Find the longest palindromic substring in a given string.
- Hint: Expand around center or use dynamic programming.
Bug of the Day
C Bug:
#include
int main() {
int arr[3] = {1, 2, 3};
for (int i = 0; i <= 3; i++) {
printf("%d ", arr[i]);
}
return 0;
}
Hint: The loop index is out of bounds!
Find and fix the issue!
#include
void printMessage(std::string msg) {
if (msg.empty()) {
std::cout << "Message is empty" << std::endl;
}
delete &msg; // Buggy line
std::cout << msg << std::endl;
}
int main() {
printMessage("Hello, World!");
return 0;
}
using System;
class Program {
static void Main() {
int[] numbers = new int[3] {1, 2, 3};
foreach (int i in numbers) {
if (i == 2) {
numbers[i] = 10; // Modifying collection inside foreach
}
Console.WriteLine(i);
}
}
}
📋 Daily Micro-Project
Frontend Challenge:
- Difficult Level: Moderate
- Tech Stack: HTML, CSS (No JavaScript)
- Bonus: Make the progress bar responsive and add a smooth gradient animation.
Mini Project: Build a Pure CSS Animated Progress Bar that fills up dynamically.
Trivia: 5 Fun Facts
- Who created Linux?
- When was JavaScript first released?
- Which company developed React?
- Which language is used in TensorFlow for backend computations?
- What was the first programming language?
-
Answer: Linus Torvalds.
-
Answer: 1995.
-
Answer: Facebook.
-
Answer: C++.
-
Answer: FORTRAN, released in 1957.
Tool of the Day
ESLint
ESLint is a popular JavaScript and TypeScript linter that helps developers find and fix problems in their code. It enforces coding standards, detects errors, and improves code quality by catching issues like unused variables, inconsistent formatting, and potential bugs. ESLint is highly configurable, allowing teams to define custom rules or extend existing rule sets, such as Airbnb, Prettier, or StandardJS. It integrates seamlessly with modern development tools and CI/CD pipelines to maintain code consistency.
Learn more:ESLint
Interview Question of the Day
Daily Interview Questions
- What is the difference between == and === in JavaScript?
- Explain the concept of closures in JavaScript with an example.
- How does CSS Grid differ from Flexbox, and when should each be used?
- What are props and state in React, and how do they differ?
- What is the difference between monolithic and microservices architecture?
- Explain how garbage collection works in Java.
- How does event-driven programming work in Node.js?
- What are the differences between POST and PUT HTTP methods?
- What is normalization in SQL, and why is it important?
- Explain the differences between ACID and BASE properties in databases.
- What is sharding, and how does it improve database performance?
- What are the key differences between a virtual machine and a container?
- Explain the role of a scheduler in an operating system.
Daily Quiz Challenge
Frontend Quiz (3 Questions)
- Which of the following best describes the difference between null and undefined in JavaScript?
- null is an assigned value, while undefined means a variable hasn't been assigned a value.
- Both mean the same thing.
- undefined is a keyword, while null is not.
- null is only used in arrays.
- Which scenario is a good use case for event delegation in JavaScript?
- Applying styles dynamically to elements.
- Handling events efficiently for dynamically added elements.
- Preventing event bubbling.
- Making AJAX requests faster.
- How does the Virtual DOM in React improve performance?
- It removes the need for state management.
- It updates only changed parts of the real DOM instead of re-rendering everything.
- It eliminates JavaScript execution in the browser.
- It converts React components into plain HTML before rendering.
Backend Quiz (3 Questions)
- What is the primary difference between synchronous and asynchronous programming in Node.js?
- Synchronous code runs line by line and blocks execution, while asynchronous code does not.
- Asynchronous programming is only possible with async/await.
- Synchronous functions execute in the background.
- Asynchronous functions execute only inside promises.
- Which of the following best describes the difference between a thread and a process?
- A process can contain multiple threads, while a thread is the smallest unit of execution.
- Threads require more memory than processes.
- A thread runs independently, while a process shares resources with other processes.
- Threads always execute on separate cores.
- How does Python handle memory management?
- It uses manual garbage collection.
- It relies on the Global Interpreter Lock (GIL) for memory allocation.
- It has automatic garbage collection and reference counting.
- It uses pointers like C++.
Database Quiz (2 Questions)
- What is the main difference between INNER JOIN and LEFT JOIN in SQL?
- LEFT JOIN returns all rows from the left table, while INNER JOIN returns only matching rows.
- INNER JOIN retrieves all records, while LEFT JOIN filters duplicates.
- LEFT JOIN only works with primary keys.
- INNER JOIN is used only with indexed columns.
- How does indexing improve query performance in databases?
- It reduces database size.
- It allows faster searching by storing a sorted reference of the data.
- It prevents duplicate rows.
- It eliminates the need for foreign keys.
Weekly Cross-Domain Activities
Task: Hints for Building a Simple Weather App using OpenWeatherMap API
- Get an API Key
- Sign up at OpenWeatherMap and get a free API key.
- Choose an HTTP Request Method
- Use fetch() in JavaScript or requests in Python to get weather data.
- API Endpoint Example
- Use this URL:
- https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY&units=metric
- Replace London with the city name and YOUR_API_KEY with your actual API key
- Extract Important Data
- Parse the JSON response to extract key details like temperature, humidity, and weather description.
- Display the Data
- Show weather details in a simple UI using HTML, CSS, and JavaScript.
- Example: Display city name, temperature, and weather conditions.
- Handle Errors Gracefully
- Show an error message if the city is not found or the API call fails.
- Enhancements (Optional)
- Allow users to enter any city name.
- Show weather icons based on conditions.
- Use geolocation to fetch the user’s current weather.
orgopenweathermap.org
Current weather and forecast - OpenWeatherMap
OpenWeather provides comprehensive weather data services, including current, forecast, and historical weather information. Explore a wide range of APIs for solar radiation, road risk assessment, solar energy prediction, and more, with global coverage and user-friendly access. Ideal for developers and businesses seeking accurate and reliable weather insights.
Real-World Project of the Week
Project: Build a Personal Portfolio Website
Tech Stack: HTML, CSS, JavaScript (Optional: React, TailwindCSS)
Previous Daily Coding Challenges & Projects : 04-04-2025