Showing 146 questions
Convert a given integer into its Roman numeral representation. You need to understand the mapping between integer values and Roman symbols to perform the conversion accurately.
#1. Integer to Roman
Calculate the exclusive execution time for each function given a series of log entries marking function calls and returns. The exclusive time is the time spent within a function, not including time spent in its callees.
#2. Exclusive Time of Functions
Write a program that prints numbers from 1 to n, replacing multiples of 3 with "Fizz", multiples of 5 with "Buzz", and multiples of both with "FizzBuzz".
#3. Fizz Buzz
Convert a Roman numeral string into its corresponding integer value. The input string will represent a valid Roman numeral.
#4. Roman to Integer
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.
#5. Best Time to Buy and Sell Stock
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.
#6. Two Sum
You are given a list of ranges. Determine the number of ways you can group overlapping ranges into connected components.
#7. Count Ways to Group Overlapping Ranges
You are given a list of meeting time intervals. Determine the minimum number of conference rooms required to accommodate all the meetings without any overlap.
#8. Meeting Rooms II
Find the smallest absolute difference between any two elements in a given array of numbers. Return this minimum difference.
#9. Minimum Absolute Difference
Given an array of integers, determine how many triplets sum up to a multiple of a given number. Count the number of such divisible triplets.
#10. Number of Divisible Triplet Sums
You are given an array of integers. Find the minimum number of operations needed to make all elements in the array equal, where an operation involves incrementing or decrementing a single element by 1.
#11. Minimum Operations to Make All Array Elements Equal
You are given a square matrix representing an image. Rotate the image by 90 degrees clockwise in-place.
#12. Rotate Image
Find the minimum number of moves required to make all elements in an array equal, where a move consists of incrementing n - 1 elements by 1.
#13. Minimum Moves to Equal Array Elements
Find the length of the longest substring within a given string that contains no repeating characters. The substring must be contiguous.
#14. Longest Substring Without Repeating Characters
You are given an array and a target value K. Determine the minimum number of operations needed to make the median of the array equal to K, where an operation involves changing an array element to any value.
#15. Minimum Operations to Make Median of Array Equal to K
Find the maximum profit you can achieve by selecting three items from a price list at increasing indices and prices. Essentially, you want to find increasing triplets that maximize profit.
#16. Maximum Profitable Triplets With Increasing Prices I
Two players alternate turns. Given the results of each game, determine the first player to win K games consecutively, or if no one wins.
#17. Find The First Player to win K Games in a Row
Find the kth factor of a given number n. If n has fewer than k factors, return -1.
#18. The kth Factor of n
You are given an array of strings. Determine how many strings within given ranges start and end with a vowel.
#19. Count Vowel Strings in Ranges
Imagine navigating a dungeon with rooms containing energy. Find the maximum energy you can collect by strategically choosing which rooms to enter, considering that entering some rooms might reduce your current energy level.
#20. Taking Maximum Energy From the Mystic Dungeon