Background This is a small codebase related to mazes. It has some basic utilities to parse a maze from a string representation, print out a maze, and at…
Build a digital representation of a movie, where a movie has a title and an optional rating between 1 and 5. Also add a way to rate a movie after creati…
Given the following 2D Bounding Box struct, write a function to merge n bounding boxes together, and return a final bounding box with the result. struct…
Given a binary tree, find the maximum path sum from any two alive nodes within the tree. We can assume a node is an alive node if and only if it is a le…
Login Form Exercise This is an incomplete login form. Do not add any additional HTML elements. The login() service works as follows: Accepts an email an…
Given a stream of data points ( * ), find the p50 and p95. [** **** * *** ****** **********] p50 = **** p95 = ****** 这道题考察的是对数据流实时计算百分位数(P50、P95)的能力。核心思…
Given an m x n 2D binary grid grid which represents a map of ‘1’ s (land) and ‘0’ s (water), return the number of islands. An island is surrounded by wa…
This section has 6 questions. For each question, read the code and type your answer under the Answer heading. You should answer the questions without ru…
How many users started a call with more than 3 different people in the last 7 days? Table name: video_calls This table has 1 row per unique call. Assume…
You are given a string consisting of the letters x and y , such as xyxxxyxyy . In addition, you have an operation called flip , which changes a single x…
Given a file system: root (id=1) dir (id=2) file1 (id=4): 100b file2 (id=5): 200b file3 (id=3): 300b It will be represented as follows: Filesystem = { 1…
Write a function that, given an x, y coordinate of a land cell, returns all water cells that touch that island. 这题的核心是先从给定的陆地坐标出发,遍历整座岛屿,再收集与岛屿边界相邻的所有水格…
There is a plot (grid-like land) with each spot having a specified elevation. Within this plot there are two villages that need water delivered to them….
Given this list, design a class to help us efficiently answer the following questions: Given a policy, find out the number of unique pins that violate t…
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:…
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…
Implement Promise.all Promise.all() takes an iterable of Promise objects and returns a single Promise. The returned Promise resolves to an array of resu…