/SDG_23-django-advance-challenge

Build for SDG 2023 backend python(django) challenge for advance

Primary LanguagePython

Build4SDG 2023

Python django intermediate challenge

Task: Django Task API

This project is a simple ExpressJS task API that allows users to create, retrieve, update, and delete tasks. The API is built using ExpressJS and MongoDB for data storage.

Expectations

TASK 1

The project is expected to have the following API endpoints:

  • Retrieve all tasks (GET /api/tasks)
  • Create a task (POST /api/tasks)
  • Retrieve a single task (GET /api/tasks/:id)
  • Update a task (PATCH /api/tasks/:id)
  • Delete a task (DELETE /api/tasks/:id)
  • Mark task as completed (PATCH /api/tasks/:id/completed)

Note - Only for the more experienced developer

  • Update the (GET /api/tasks) to allow user filter task either by dueDate, status or title.

TASK 2

Complete the two question in the django/SDG23/solve.py. The getMaxSum and uniqueChars function

Question 1 - getMaxSum

Write a function called getMaxSum that takes an array of integers as input and returns the maximum sum of any contiguous subarray of the given array. If the array is empty or contains only negative integers, the function should return 0. The getMaxSum function takes an array of integers as input and returns the maximum sum of any contiguous subarray of the given array. If the array is empty or contains only negative integers, the function should return 0.

Example Input and Output

Example 1

Input

 getMaxSum([1, -3, 2, 1, -1]);

output

 3

Question 2 - uniqueChars

Complete the uniqueChars that takes a string as input and returns a new string containing only the unique characters in the input string, in the order that they first appear. If the input string is empty or contains only whitespaces, the function should return an empty string.

// For example, if the input string is "hello world", the function should return "helo wrd".

Example Input and Output

Example 1

Input

 uniqueChars("hello world");

output

 "helo wrd"

Example 2

Input

 uniqueChars("");

output

 ""

NOTE:

  • project directory - django/SDG23
  • App directory - django/todo_api
  • virtual environment - django/.venv

Best of LUCK!!!, ENJOY!!!

Contributors

License NIL