Arrays
Arrays
1. Two Sum
Description: Find two numbers in an array that add up to a specific target value.
Test Cases: - Input: nums = [2, 7, 11, 15], target = 9 → Output: [0, 1]
- Input: nums = [3, 2, 4], target = 6 → Output: [1, 2]
- Input: nums = [3, 3], target = 6 → Output: [0, 1]
1
6. Rotate Array
Description: Given an elevation map, compute how much water it is able to trap
after raining.
Test Cases: - Input: nums1 = [4,1,2], nums2 = [1,3,4,2] → Output: [-1, 3, -1]
- Input: nums1 = [2,4], nums2= [1,2,3,4] → Output: [3,-1]