Given a balanced parentheses string s , return the score of the string. The score of a balanced parentheses string is based on the following rules: () h…
Implement function to check if a key exists in a BST recursively and iteratively. Given a binary search tree, determine whether a target key is present…
Given an array of integers, find the maximum possible product of any three numbers in the array. 这道题的核心是不要只盯着最大的三个数,因为两个负数相乘可能变成正数,从而让结果更大。常见做法是一次遍历维护数组…
Given a linked list, write a function to return the top N largest elements in the list. Return the result in descending order. 这道题的核心是从一个有序或无序的链表中找出最大的前…
Given a list of current directories and a list of selected directories, return the selected directories after summarizing. Example: The entire directori…
Given a sequence S of N digits, find a subsequence of K digits such that the number formed by these K digits, in order, is the largest. 这道题要求从一个由 N 个数字组…
You are creating a website where people can track buses and figure out when to go to the station. The buses move between the stations in one direction….
Question description E-commerce detail page Swipe up and down. For each detail page, generate an AI summary by combining the user profile and product in…
There is a string of length N made only of letters a . Whenever there are two identical adjacent letters (e.g. aa ), they can be transformed into a sing…
You are given a table of people with three columns: Name , Start , and End . Each row represents an interval for a person. Create a second table with co…
Modify an Array Given an array of integers, the cost to change an element is the absolute difference between its initial value and its new value. For ex…
Let’s pretend we’re working on a computer vision project. In this project, librarians sent us videos of their bookshelves. Based on frames from these vi…
Amazon products are stored hierarchically within their respective categories. Products have various metadata, such as current price and whether they are…
Suppose you are given 2 unordered lists of Amazon products with product id, price and a gift coupon worth S amount. Can you write a function to find 1 p…
Like Button States A button can appear in three different states: normal , hovered , and clicked . In the normal state, the button is outlined with a ne…