Leetcode
Showcasing my solutions to Leetcode problems in Go alongside my thought process and approach to solving them.
42. Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.
239. Sliding Window Maximum
You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.
19. Remove Nth Node From End of List
Given the head of a linked list, remove the nth node from the end of the list and return its head.
143. Reorder List
You are given the head of a singly linked-list. The list can be represented as:
981. Time Based Key
Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at a certain timestamp.
33. Search in Rotated Sorted Array
There is an integer array nums sorted in ascending order (with distinct values).
206. Reverse Linked List
Given the head of a singly linked list, reverse the list, and return the reversed list.
74. Search a 2D Matrix
You are given an m x n integer matrix matrix with the following two properties:
347. Top K Frequent Elements
Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.
1. Two Sum
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.