Credits Implement the Credits class, which should support the following operations: granting credits, subtracting credits, and getting the balance for a…
Implement 2 functions: A’ = encode(A) takes in a string (ASCII only) that represents the document A , and returns the binary string representation of th…
An Amazon pickup location has a set number of lockers in which boxes are dropped off and picked up. Boxes can come in many different sizes. Lockers come…
There are three companies: IBM, Intel, and Apple. A total of 8 people worked in these three companies. Each person can be either a manager or a direct r…
You are developing an online game where 2 users can play against each other. We want to create a service which will match users with similar ranks so th…
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 这道题本质上是经典编辑距离的变体:给定两个字符串,需要通过插入、删除、替换等操作把一个字符串变成另一个字符串,但每种操作的代价不是固定值,而是由字典规则决定。解题时通常用动态规划来维护前…
Given two integer arrays nums1 and nums2 , find their intersection. Example 1: nums1: [1, 2, 3, 4] nums2: [1, 2] result: [1, 2] 这道题要求找出两个整数数组的交集,核心思路通常是…
We are writing software to collect and manage data on how fast racers can complete obstacle courses. An obstacle course is a series of difficult physica…
You have to paint all the houses such that no two adjacent houses have the same color. The cost of painting each house with a certain color is represent…
Create a REST API that exposes the following endpoint: GET /api/bootstrap Request Input User Id Response Address Data: address including the user’s name…
Given a binary tree, create two functions: one that serializes the binary tree into a string and one that deserializes a serialized string back into a b…
Write a function which, given an array of integers, returns the length of the longest subsequence where every next value is 1 bigger than the previous o…
Given a binary tree (pointer to the root), a target node anywhere in the tree, and an integer value K , return a list of the values of all the nodes tha…
You’re given an R-by-C array of integers that represents a top-down map of a building construction site, where each location in the array represents a o…
Systems Diagram Do not spend time trying to make this pretty. It is just a tool to understand your thought process and have a shared understanding of th…
You need to implement a function that fuses batch normalization layers within a PyTorch Sequential module. To be more precise, the objective is to merge…
Implement a simple event system with two operations. public interface Callback { void run(); } class Event { void registerCallback(Callback cb) { // fil…
Can You Reach the Last Traffic Light? distances = [10, 17, 25] traffic lights distance clock = [3, 5, 10] each has a clock max_time = 1200 car in zero,…