Best Time to Buy and Sell Stock
Problem Statement You are given an array prices where prices[i] represents the price of a given stock on the ith day. You want to maximize your profit by buying the stock on one day and selling it...
Problem Statement You are given an array prices where prices[i] represents the price of a given stock on the ith day. You want to maximize your profit by buying the stock on one day and selling it...
Collection Type Hierarchy Collection (Interface) ├── List (Interface) │ ├── ArrayList │ ├── LinkedList │ └── Arrays.asList() ├── Set (Interface) │ ├── HashSet │ ├── LinkedHashSet │ └──...
Problem Statement 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. Solve Here: Trapping Rain Water ...
Problem Statement You are given an integer array height of length n, where each value represents the height of a vertical line drawn at that index. The task is to find two lines that, together wit...
Problem Statement Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that: i != j, i != k, and j != k nums[i] + nums[j] + nums[k] == 0 The solution set mu...
Problem Statement Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numb...
Problem Statement A string is considered a palindrome if, after converting all uppercase letters to lowercase and removing all non-alphanumeric characters, it reads the same forward and backward. ...
Problem Statement Design an algorithm to encode a list of strings to a single string. The encoded string should be able to be decoded back into the original list of strings. You need to: Imple...
Problem Statement Determine if a 9 x 9 Sudoku board is valid. The board is considered valid if: Each row contains the digits 1-9 without repetition. Each column contains the digits 1-9 withou...
Problem Statement Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. The algorithm should run in O(n) time complexity. Solve Here: Longest ...