- Task 1: Solve the "Two Sum" problem on LeetCode.
- Write a function that takes an array of numbers and a target number, and returns the indices of the two numbers that add up to the target.
- Log the indices for a few test cases.
- Task 2: Solve the "Reverse Integer" problem on LeetCode.
- Write a function that takes an integer and returns it with its digits reversed.
- Handle edge cases like negative numbers and numbers ending in zero.
- Log the reversed integers for a few test cases.
- Task 3: Solve the "Palindrome Number" problem on LeetCode.
- Write a function that takes an integer and returns true if it is a palindrome, and false otherwise.
- Log the result for a few test cases, including edge cases like negative numbers.
- Task 4: Solve the "Merge Two Sorted Lists" problem on LeetCode.
- Write a function that takes two sorted linked lists and returns a new sorted list by merging them.
- Create a few test cases with linked lists and log the merged list.
- Task 5: Solve the "Valid Parentheses" problem on LeetCode.
- Write a function that takes a string containing just the characters '(', ')', '{', '}', '[' and ']', and determines if the input string is valid.
- A string is valid if open brackets are closed in the correct order.
- Log the result for a few test cases.
- Two Sum Script: Write a script that includes a function to solve the "Two Sum" problem and logs the indices of the two numbers.
- Reverse Integer Script: Create a script that includes a function to reverse an integer and handles edge cases.
- Palindrome Number Script: Write a script that includes a function to check if an integer is a palindrome and logs the result.
- Merge Two Sorted Lists Script: Create a script that includes a function to merge two sorted linked lists and logs the merged list.
- Valid Parentheses Script: Write a script that includes a function to check if a string of parentheses is valid and logs the result.
By the end of these activities, students will:
- Solve common LeetCode problems.
- Apply problem-solving skills to implement algorithms.
- Understand and handle edge cases in algorithmic solutions.
- Gain confidence in solving easy-level coding challenges on LeetCode.