Company: amazon
All the problems asked by "amazon".
-
Leetcode 2781 - Length of the Longest Valid Substring
Given a string and an array of forbidden substrings, find the length of the longest valid substring of the string.
-
Leetcode 1567 - Maximum Length of Subarray With Positive Product
Given an array of integers, find the maximum length of a subarray where the product of all its elements is positive.
-
Leetcode 42 - Trapping Rain Water
Given an elevation map, compute how much water it can trap after raining.
-
LeetCode 1492 - The kth Factor of n
Find the kth factor of a given integer n in ascending order, considering optimal solutions for performance.
-
Leetcode 271 - Encode and Decode Strings
Design an algorithm to encode a list of strings into a single string and decode it back to the list, working with any set of characters.
-
LeetCode 36 - Valid Sudoku
Determine if a 9x9 Sudoku board is valid based on specific rules for rows, columns, and 3x3 sub-boxes.
-
Leetcode 435 - Non-overlapping Intervals
Given an array of intervals, find the minimum number of intervals to remove to make the rest non-overlapping.
-
Leetcode 128 - Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence with an O(n) time complexity algorithm.
-
LeetCode 1431 - Kids With the Greatest Number of Candies
Determine if each child can have the greatest number of candies after giving them extra candies.
-
LeetCode 2405 - Optimal Partition of String
Given a string, partition it into substrings such that each substring contains unique characters. Find the minimum number of such substrings.
-
Leetcode 347 - Top K Frequent Elements
Given an integer array and an integer k, find the k most frequent elements in the array.
-
Leetcode 56 - Merge Intervals
Given an array of intervals, merge all overlapping intervals and return the non-overlapping intervals that cover the entire range.
-
Leetcode 57 - Insert Interval
Insert a new interval into a sorted array of non-overlapping intervals, merging overlapping intervals if necessary.
-
Leetcode 49 - Group Anagrams
Given an array of strings, group anagrams together. An anagram is a word formed by rearranging the letters of a different word, using all original letters exactly once.
-
Leetcode 242 - Valid Anagram
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
-
Leetcode 322 - Coin Change
Given an array of coin denominations and a total amount, determine the minimum number of coins needed to make up that amount, or return -1 if it's not possible.
-
Leetcode 70 - Climbing Stairs
Determine the number of distinct ways to climb to the top of a staircase with 'n' steps, where each time you can climb 1 or 2 steps.
-
Leetcode 11 - Container With Most Water
Given an array of integers representing the height of vertical lines, find the maximum amount of water a container formed by these lines can store.
-
Leetcode 371 - Sum of Two Integers
Given two integers a and b, return the sum of the two integers without using the operators + and -.
-
Leetcode 15 - 3Sum
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. The solution set must not contain duplicate triplets.
-
Leetcode 153 - Find Minimum in Rotated Sorted Array
Given a sorted rotated array of unique elements, return the minimum element of this array.
-
Leetcode 152 - Maximum Product Subarray
Given an integer array nums, find a subarray that has the largest product, and return the product.
-
Leetcode 217 - Contains Duplicate
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
-
Leetcode 53 - Maximum Subarray
Given an integer array nums, find the subarray with the largest sum and return its sum.
-
Leetcode 121 - Best Time to Buy and Sell Stock
You want to maximize your profit by choosing a single day to buy one stock and a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction.
-
Leetcode 238 - Product of Array Except Self
Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].
-
Leetcode 567 - Permutation in String
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
-
Leetcode 33 - Search in Rotated Sorted Array
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.
-
Leetcode 167 - Two Sum II
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
-
Leetcode 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.