Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 2.76 KB

Day 23 - LeetCode Hard Assignment.md

File metadata and controls

42 lines (34 loc) · 2.76 KB

Day 23: LeetCode Hard

Tasks/Activities:

Activity 1: Median of Two Sorted Arrays

  • Task 1: Solve the "Median of Two Sorted Arrays" problem on LeetCode.
    • Write a function that takes two sorted arrays of integers and returns the median of the two sorted arrays.
    • Log the median for a few test cases, including edge cases.

Activity 2: Merge k Sorted Lists

  • Task 2: Solve the "Merge k Sorted Lists" problem on LeetCode.
    • Write a function that takes an array of k linked lists, each linked list is sorted in ascending order, and merges all the linked lists into one sorted linked list.
    • Create a few test cases with linked lists and log the merged list.

Activity 3: Trapping Rain Water

  • Task 3: Solve the "Trapping Rain Water" problem on LeetCode.
    • Write a function that takes an array of non-negative integers representing an elevation map where the width of each bar is 1, and computes how much water it can trap after raining.
    • Log the amount of trapped water for a few test cases.

Activity 4: N-Queens

  • Task 4: Solve the "N-Queens" problem on LeetCode.
    • Write a function that places n queens on an n×n chessboard such that no two queens attack each other, and returns all distinct solutions to the n-queens puzzle.
    • Log the distinct solutions for a few test cases.

Activity 5: Word Ladder

  • Task 5: Solve the "Word Ladder" problem on LeetCode.
    • Write a function that takes a begin word, an end word, and a dictionary of words, and finds the length of the shortest transformation sequence from the begin word to the end word, such that only one letter can be changed at a time and each transformed word must exist in the word list.
    • Log the length of the shortest transformation sequence for a few test cases.

Feature Request:

  1. Median of Two Sorted Arrays Script: Write a script that includes a function to find the median of two sorted arrays and logs the median.
  2. Merge k Sorted Lists Script: Create a script that includes a function to merge k sorted linked lists and logs the merged list.
  3. Trapping Rain Water Script: Write a script that includes a function to calculate the amount of trapped rainwater and logs the result.
  4. N-Queens Script: Create a script that includes a function to solve the N-Queens problem and logs the distinct solutions.
  5. Word Ladder Script: Write a script that includes a function to find the shortest transformation sequence in a word ladder and logs the sequence length.

Achievement:

By the end of these activities, students will:

  • Solve complex LeetCode problems.
  • Apply advanced problem-solving skills to implement efficient algorithms.
  • Understand and handle edge cases in hard algorithmic solutions.
  • Gain confidence in solving hard-level coding challenges on LeetCode.