Merge In Between Description Consider two linked lists, list1 and list2 , and two integers, i and j . Replace the nodes from the i th to the j th positi…
8-Puzzle Description The 8 Puzzle is a sliding block game played on a 3×3 grid containing 8 numbered tiles (from 1 to 8) and one empty space represented…
Coding 1 You are given an array of integers nums and an integer k . Return the k most frequent elements in the array. 这道题要求从整数数组中找出出现频率最高的前 k 个元素。核心思路通常…
LRU Map Design a data structure that supports storing key-value pairs and evicting the least recently used entry when capacity is exceeded. Implement th…
You are given a sorted list of distinct integers from 0 to 99, for instance [0, 1, 2, 50, 52, 75] . Your task is to produce a string that describes the…
Design a notification system that receives notification requests and sends notifications to users through phone or email. The system should be scalable,…
1. Explain what the code does. 2. Write test cases and check for any bugs. 3. Explain the purpose of the StringBuilder class in this code. You are given…
You are given a 0-indexed integer array coins , representing the values of the coins available, and an integer target . An integer x is obtainable if th…
Problem: Numbers, arrange them such that negative numbers are to the left of 0 and positive numbers are to the right of 0. The goal is to rearrange the…
Count Connected Components in a Binary Matrix Given a binary matrix, count the number of connected components formed by the cells with value 1 . Cells a…
Assume you run a movie theater that has many auditoriums, and every day you need to schedule movies into those auditoriums. You want to schedule all mov…
Given a string, return the longest recurring substring. 这道题要求在一个字符串中找出最长的重复子串,也就是在原串中至少出现两次的连续子串,并返回长度最长的那个。常见思路是结合后缀数组、后缀树,或者用二分答案配合哈希/滚动哈希来判断某个长度的子串是否…
Problem: Given a 2D array of integers representing a paint canvas, where each integer represents a color, write a function that takes a point in the arr…
Given an array of N integers containing integers from 1 to N only. Some numbers may appear multiple times, some numbers may not appear. Write code to pr…
Given a list of meetings, where a meeting has a start and an end time, determine the minimum number of rooms required to schedule all the meetings witho…
Given a string s containing just the characters ‘(‘ , ‘)’ , ‘{‘ , ‘}’ , ‘[‘ and ‘]’ , determine if the input string is valid. An input string is valid i…
Given an array of integers, find the maximum possible product of any three numbers in the array. 这道题的核心是不要只盯着最大的三个数,因为两个负数相乘可能变成正数,从而让结果更大。常见做法是一次遍历维护数组…
For an array of n positive integers arr and an integer k , a subarray is considered good if it consists of at least k distinct integers. Find the minimu…
There are N points on a plane, numbered from 0 to N – 1. The coordinates of the K-th point are (X[K], Y[K]). Find any triangle with vertices at three of…