Min Stack LeetCode Solution
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
Implement pow(x, n), which calculates x raised to the power n.
Given an array of strings strs, group the anagrams together. You can return the answer in any order.
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.
Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list’s nodes.
Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.
Given the head of a singly linked list, reverse the list, and return the reversed list.
Given a string s containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string is valid.
Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.
Given a string s, return the longest palindromic substring in s. A palindrome is a string which reads the same in both directions. For example, S = “aba” is a palindrome, S = “abc” is not.
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Given a string s, find the length of the longest substring without repeating characters.
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice.
Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same.