Showing 25 questions
Given a string, find the minimum number of characters you must delete so that all remaining character frequencies are unique. No two characters can have the same frequency.
#1. Minimum Deletions to Make Character Frequencies Unique
Given an array of numbers, find the longest prefix where removing exactly one element makes all remaining element frequencies equal. Return the length of this prefix.
#2. Maximum Equal Frequency
You're given a mysterious function and a target value. Find an input value to the function that produces an output closest to the target.
#3. Find a Value of a Mysterious Function Closest to Target
You're given an array of numbers and can perform a specific bitwise XOR operation on them any number of times. Find the maximum possible XOR of all the numbers in the array after performing these operations.
#4. Maximum XOR After Operations
An ugly number is divisible by at least one of given integers a, b, and c. Find the nth ugly number given a, b, c, and n.
#5. Ugly Number III
You're given an array and a number of moves (k). In each move, you can remove the topmost element or add back the last removed element. Maximize the topmost element after exactly k moves.
#6. Maximize the Topmost Element After K Moves
You are given two arrays of integers with values between 1 and 6. Determine the minimum number of operations to make the sums of the two arrays equal by changing individual values.
#7. Equal Sum Arrays With Minimum Number of Operations
Calculate the percentage of a specific character within a given string. Return the percentage as an integer.
#8. Percentage of Letter in String
You're given an array and need to divide it into three non-empty subarrays. The cost is the sum of the first elements of each subarray. Find the minimum possible cost to divide the array.
#9. Divide an Array Into Subarrays With Minimum Cost I
You're given an array and need to divide it into a specific number of subarrays. The goal is to minimize the total cost of these subarrays, where the cost is calculated based on the subarray elements and a given penalty.
#10. Divide an Array Into Subarrays With Minimum Cost II
You're given an array and a target value K. Find the fewest bit flips needed across the array's elements to make their bitwise XOR equal to K.
#11. Minimum Number of Operations to Make Array XOR Equal to K
Find two numbers in a given array that add up to a specific target value, and return their indices. Essentially, you need to efficiently locate the pair that satisfies the sum requirement.
#12. Two Sum
Determine if two strings are anagrams of each other, meaning they contain the same characters in a different order. You need to check if one string can be rearranged to form the other.
#13. Valid Anagram
Find all unique triplets in an array that sum to zero. You'll need to consider the potential for duplicate numbers and avoid duplicate triplets in your solution.
#14. 3Sum
Determine if a given string is a palindrome, considering only alphanumeric characters and ignoring cases. Essentially, check if the string reads the same forwards and backward after removing non-alphanumeric characters and converting to lowercase.
#15. Valid Palindrome
You're given daily stock prices. Find the maximum profit you can make by buying and selling the stock once. You must buy before you sell.
#16. Best Time to Buy and Sell Stock
Given an array, rotate the elements to the right by a specified number of steps. The goal is to modify the original array in-place with the rotated elements.
#17. Rotate Array
Imagine a network of cities connected by roads. Find the minimum fuel cost to transport everyone to the capital city, considering each car can only hold a limited number of people.
#18. Minimum Fuel Cost to Report to the Capital
Determine if a linked list has a cycle. If a cycle exists, find the node where the cycle begins.
#19. Linked List Cycle II
Given a collection of distinct integers, find all possible permutations (orderings) of the elements. Return a list of these permutations.
#20. Permutations