Determine if an undirected graph has cycle. Example 1: [[1,2],[1,3],[2,3]] -> return true Example 2: [[1,2],[2,3],[3,4],[1,5]] -> return false 这道题要求判断一个…
We are given an array asteroids of integers representing asteroids in a row. The indices of the asteroids in the array represent their relative position…
A multiset (also known as a bag) is a mutable, unordered collection of distinct objects that may appear more than once in the collection. Implement a mu…
Implement Connect6 . Connect6 is a simple board game similar to tic-tac-toe. There are two players, black and white, who alternate turns placing their c…
Best Friend Best friend: is a friend in one’s list who likes his content the most. Using Jack as an example, Jack likes Rachel’s post 5 times, but 0 for…
Find first non-repeated character in a string. Examples: AAABBBC , returns C . AAABBBCD , returns C . ABABABCD , returns C . 这道题要求在字符串中找出第一个只出现一次的字符,并返回…
Write a function that calculates the dot product of two vectors. 96% of vector components are zero. What is a good data structure for v1 , v2 so that yo…
When someone drags their finger across a phone’s keyboard, we can record the letters they intersected, creating a swype path . Given a swype path and a…
Question description Design and implement a tab component. The component should support switching between multiple tabs and displaying the corresponding…
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…
You and a friend have received a special gold chain as a gift. The chain links each have an integer weight, not necessarily the same. You and your frien…
Shopping Cart Billing An e-commerce company is currently celebrating ten years in business. They are having a sale to honor their privileged members, th…
Given a string s containing only lowercase English letters and parentheses, reverse the strings in each pair of matching parentheses from the innermost…
What is the log order of the code above? Question description async function async1() { console.log(‘async1 start’); await async2(); console.log(‘async1…
Please implement a Python function that takes a non-negative integer argument n as input, and it produces a list of all binary strings with length n suc…
Assume you work at a video streaming service and are asked to build a solution that will recommend videos to users on their home page. How would you app…