You are given a series of packages arranged on a conveyor belt. Each package has a specific weight, represented by the array weights , where the i th el…
Edit distance between 2 strings with dictionary-based cost 这道题本质上是经典编辑距离的变体:给定两个字符串,需要通过插入、删除、替换等操作把一个字符串变成另一个字符串,但每种操作的代价不是固定值,而是由字典规则决定。解题时通常用动态规划来维护前…
You are working for a local supply company. You have shelves of the same width shelf_width and several types of boxes with widths box_widths[] . You’re…
There are people in a line filming a TikTok. You are given an integer array heights of size n that represents the heights of the people in the line. The…
Maximum Subarray Given an integer array nums , find the subarray with the largest sum, and return its sum. Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output:…
Version Sort Versions is a version number list for a project. Because many people maintain it, the format is irregular. Given an array of version string…
Title Evaluate Division Question description You are given an array of variable pairs equations and an array of real numbers values, where equations[i]…
Build a React app that displays a counter starting at 0 . Requirements: Show the text You clicked {count} times . Render a button labeled Click Me . Whe…
Given an array of positive integers nums and an integer k , return true if nums has a continuous subarray whose sum equals k . Examples: nums = [1,2,3,4…
Question 1: You are given two arrays with positive integers arr1 and arr2 . A prefix of a positive integer is an integer formed by one or more of its di…
Given an unsorted array of integers nums , return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n)…
Q: Implement sum() so that the following expressions evaluate correctly: sum(1, 2, 3).sumOf(); // 6 sum(2, 3)(2).sumOf(); // 7 sum(1)(2)(3)(4).sumOf();…
Problem Description Input: N (1-20) Requirement: Count how many numbers with at most N digits do not contain consecutive digit 6 s. Example: 2, 0~99, in…
You are to build a simple key-value store for storing integers (keys are strings, values are integers) and a global version number (integer). You will n…
Two strings are said to be similar if they are composed of the same characters. For example, “abaca” and “cba” are similar since both of them are compos…
Given an array A and a number b. Return a reordered array such that all numbers before b are smaller than or equal to b, and all numbers after b are gre…
We have Uber HCV (High Capacity Vehicles) plying on the same routes in loops. Every route has a certain number of stops. The routes are represented as a…
The ocean is to the right of the buildings. A building has an ocean view if the building can see the ocean without obstructions. Formally, a building ha…