Showing 26 questions
Simulate a simple bank system that supports basic operations like deposit, withdraw, and check balance for different accounts. You will implement methods to handle these transactions and ensure validity based on account balances and existence.
#1. Simple Bank System
You are given file paths and their content. Find and return groups of duplicate files based on their content.
#2. Find Duplicate File in System
Simulate the Game of Life, updating the state of a board based on the rules of cell survival and death in each generation. Modify the board in place to represent the next generation.
#3. Game of Life
Simulate a web crawler to visit a website and collect webpages following specific rules. You'll need to avoid revisiting pages and stay within the same domain.
#4. Web Crawler
Implement a multithreaded web crawler to efficiently explore and retrieve pages from a website, respecting the website's rules.
#5. Web Crawler Multithreaded
Determine if a string follows the same pattern as another string, where pattern letters uniquely correspond to non-empty substrings. This is like Word Pattern I but requires mapping to strings instead of single characters.
#6. Word Pattern II
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.
#7. Two Sum
Determine if a string follows the same pattern as another string, where pattern refers to a bijective mapping between characters and words. Check if the arrangement of words adheres to the character pattern.
#8. Word Pattern
Imagine a network of computers where some are infected with malware. You need to find the best computer to initially disinfect to minimize the total spread of the malware across the network.
#9. Minimize Malware Spread
Imagine a grid where lamps can illuminate cells, including diagonally. Determine which cells are lit after placing and removing lamps based on given queries.
#10. Grid Illumination
In a network, find the node to remove that minimizes the spread of malware. Removing that single node should result in the fewest newly infected computers.
#11. Minimize Malware Spread II
Determine if a given array of positive integers is considered "good". An array is "good" if you can obtain 1 by taking the greatest common divisor (GCD) of all the numbers in a subsequence of the array.
#12. Check If It Is a Good Array
Given a string and a dictionary of words, find all possible ways to break the string into space-separated words from the dictionary. Return the list of these valid sentences.
#13. Word Break II
Design a system to manage seat reservations in an auditorium. Implement methods to reserve the smallest available seat and unreserve a given seat.
#14. Seat Reservation Manager
Design a hit counter that records hits and retrieves the number of hits in the past 5 minutes. You need to implement methods to record a hit and get the total hits in a sliding window.
#15. Design Hit Counter
Simulate the basic operations of a text editor. Implement functions to add text, delete characters, and move the cursor.
#16. Design a Text Editor
Given a string of digits, return all possible letter combinations that the number could represent, using the typical phone keypad mapping. The goal is to generate all valid combinations in any order.
#17. Letter Combinations of a Phone Number
Find the median of two sorted arrays. The arrays can be of different sizes, and you should aim for an efficient solution.
#18. Median of Two Sorted Arrays
You're given a list of words and a list of puzzles. For each puzzle, determine how many words from the word list are valid, where a word is valid if it contains the first letter of the puzzle and all of its letters are present in the puzzle.
#19. Number of Valid Words for Each Puzzle
Imagine a grid of land and water. Find the largest connected area of land and return its size.
#20. Max Area of Island