Anagram Substrings
Given two strings s0 and s1, return the number of substrings where s1 contains any anagram of s0.
Given two strings s0 and s1, return the number of substrings where s1 contains any anagram of s0.
Given a list of integers nums, remove numbers that appear multiple times in the list, while maintaining order of the appearance in the original list.
Implement a frequency stack with the following methods:
Given an unsorted array of integers nums, find the length of the longest sequence of consecutive elements.
Given a string s, find the length of the longest substring that contains at most 2 distinct characters.
Given a list of integers nums and an integer k, return whether there are four distinct elements in the list that add up to k.
You are given a list of integers nums and an integer target. In one operation we can remove any two numbers in nums if the pair sums to target. Return the ma...
You are a given a string s containing "X", "(", and ")". The string has balanced brackets and in between there are some "X"s along with possibly nested brack...
Implement a data structure with the following methods:
Given a list of integers nums, order nums by frequency, with most frequent values coming first. If there’s a tie in frequency, higher valued numbers should c...
You are given a two-dimensional integer matrix, where matrix[r][c] represents the height of a condominium in a city.
You are given a two-dimensional integer matrix of 1s and 0s, where a 1 represents a bomb and 0 represents an empty cell. When a bomb explodes, all the spaces...
Implement a data structure with the following methods:
Given a list of strings words, group all anagrams together and return the size of the largest grouping.
Given a string s of lowercase alphabet characters, and an integer k, return the minimum number of changes needed in the string (one change involves changing ...
Given a list of integers nums, return the number of sublists where the first element and the last element have the same value.
Given a string s, determine whether any anagram of s is a palindrome.
Given two strings s0 and s1, return whether they are anagrams of each other.
Given a two-dimensional matrix of integers, for each zero in the original matrix, replace all values in its row and column with zero, and return the resultin...
Given a list of strings words and a string letters, return the length of longest string in words that can be made from letters in letters. If no word can be ...
Implement a boolean array which implements the following methods:
You are given a two-dimensional list of strings contacts. Each element contacts[i] represents the list of emails for contact i. Contact i is considered a dup...
Given a list of integers nums, return whether the number of occurrences of every value in the array is unique.
Implement the tic-tac-toe game with the following methods:
You are given two lowercase alphabet strings s and t, both of them the same length. You can pick one character in s and another in t and swap them. Given you...
Given a list of numbers nums and a number k, return whether any two elements from the list add up to k. You may not use the same element twice.
Given a list of integers nums and an integer k, determine if there are three distinct elements in the list that add up to k.
Given lowercase alphabet strings s, and t return whether you can create a 1-to-1 mapping for each letter in s to another letter (could be the same letter) su...
You are given a list of integers nums. Let k be the frequency of a most frequent number in nums. Return the length of a shortest sublist such that the freque...
You are given a list of integers items and an integer n. A salesperson has items in a bag with random IDs. The salesperson can remove as many as n items from...
Given a list of integers nums, find all duplicate numbers and delete their last occurrences.
Given a list of integers nums and an integer target, return the number of sublists whose sum is equal to target.
You are given a two-dimensional list of integers relations. Each element relations[i] contains [a, b] meaning that person a is following person b on Twitter.
You are given two strings s and t of equal length only consisting of lowercase letters. Assuming that you can first rearrange s into any order, return the mi...
You are given a list of integers nums and an integer n. Given you must remove exactly n numbers, return the least number of unique integers after the removal...
Given a list of strings strs, containing the strings "red", "green" and "blue", partition the list so that the red come before green, which come before blue.
You are given a list of integers nums, representing the number of chess matches each person has won. Return a relative ranking (0-indexed) of each person. If...
Given an n by n matrix of letters matrix, return whether there are exactly n different letters that appear in the matrix and each letter appears exactly once...
Given a list of integers nums, return the largest integer k where k and -k both exist in nums (they can be the same integer). If there’s no such integer, ret...
Given a list of integers nums, find the most frequently occurring element and return the number of occurrences of that element.
Implement a hash table with the following methods:
Given a list of integers nums, find the first missing positive integer. In other words, find the lowest positive integer that does not exist in the list. The...
Implement a data structure with the following methods:
Given a list of integers nums, return whether there’s an integer whose frequency in the list is same as its value.
You are given a list of integers nums. Return the number of pairs i < j such that nums[i] = nums[j].
Given a two dimensional list of integers votes, where each list has two elements [candidate_id, voter_id], report whether any voter has voted more than once.
Given two strings s0 and s1, each representing a sentence, return the number of unique words that are shared between the two sentences.
You are given a two-dimensional matrix of unique strings representing city blocks, and a list of strings blocks to visit. Given that you are sitting at block...
Given a lowercase alphabet string s, determine whether it has all unique characters.
Given a list of integers nums, return whether there’s two numbers such that one is a triple of another.