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 ik 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 nen 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 1 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 ward must exist in the word list.
- Log the length of the shortest transformation sequence for a few test cases.
-
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.
-
Merge k Sorted Lists Script: Create a script that includes a function. to merge ki sorted linked lists and logs the merged list.
-
Trapping Rain Water Script: Write a script that includes a function to to calculate the amount of trapped rainwater and logs the result.
-
N-Queens Script: Create a script that includes a function to solve the N-Queens problem and logs the distinct solutions.
-
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.
By the end of these activities, you 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.
