Avatar

Organizations

31 results for 简单
  • 给你一个正整数数组 arr ,请你计算所有可能的奇数长度子数组的和。

    子数组 定义为原数组中的一个连续子序列。

    请你返回 arr 中 所有奇数长度子数组的和

    leetcode 简单 数组 数学 前缀和 Created Fri, 02 Dec 2022 14:13:41 +0800
  • 农夫约翰把杂志上所有的文章摘抄了下来并把它变成了一个长度不超过 106 的字符串 S。

    他希望从 S 中删除子串 T。

    农夫约翰在 S 中从头开始寻找子串 T,一旦找到,就将它从 S 中删除,然后再次从头开始寻找(而不是接着往下找)。

    他重复这个操作直到 S 中没有子串 T 为止。

    注意,删除一个子串 T 可能会导致一个新的子串 T 的出现。

    请帮助约翰完成这些操作并输出最后的 S。

    acwing 简单 字符串 Created Fri, 15 Apr 2022 13:43:00 +0800
  • Table: Product

    Column NameType
    product_idint
    product_namevarchar
    unit_priceint

    product_id is the primary key of this table. Each row of this table indicates the name and the price of each product.

    Table: Sales

    Column NameType
    seller_idint
    product_idint
    buyer_idint
    sale_datedate
    quantityint
    priceint

    This table has no primary key, it can have repeated rows. product_id is a foreign key to the Product table. Each row of this table contains some information about one sale.

    Write an SQL query that reports the products that were only sold in the spring of 2019. That is, between 2019-01-01 and 2019-03-31 inclusive.

    Return the result table in any order.

    The query result format is in the following example.

    leetcode 简单 数据库 Created Wed, 13 Apr 2022 17:42:35 +0800
  • 给定一个浮点数 n,求它的三次方根。

    acwing 简单 二分 Created Thu, 07 Apr 2022 17:04:33 +0800
  • 给定你一个长度为 n 的整数数列。

    请你使用快速排序对这个数列按照从小到大进行排序。

    并将排好序的数列按顺序输出。

    acwing 简单 快速排序 Created Thu, 07 Apr 2022 17:04:23 +0800
  • 给定一个长度为 n 的整数数列,请你计算数列中的逆序对的数量。

    逆序对的定义如下:对于数列的第 i 个和第 j 个元素,如果满足 i<j 且 a[i]>a[j],则其为一个逆序对;否则不是。

    acwing 简单 归并排序 Created Thu, 07 Apr 2022 17:04:13 +0800
  • Table: Tree

    Column NameType
    idint
    p_idint

    id is the primary key column for this table. Each row of this table contains information about the id of a node and the id of its parent node in a tree. The given structure is always a valid tree.

    Each node in the tree can be one of three types:

    • “Leaf”: if the node is a leaf node.
    • “Root”: if the node is the root of the tree.
    • “Inner”: If the node is neither a leaf node nor a root node.

    Write an SQL query to report the type of each node in the tree.

    Return the result table ordered by id in ascending order.

    The query result format is in the following example.

  • Table: Products

    Column NameType
    product_idint
    store1int
    store2int
    store3int

    product_id is the primary key for this table. Each row in this table indicates the product’s price in 3 different stores: store1, store2, and store3. If the product is not available in a store, the price will be null in that store’s column.

    Write an SQL query to rearrange the Products table so that each row has (product_id, store, price). If a product is not available in a store, do not include a row with that product_id and store combination in the result table.

    Return the result table in any order.

    The query result format is in the following example.

  • Table: Employees

    Column NameType
    employee_idint
    namevarchar

    employee_id is the primary key for this table. Each row of this table indicates the name of the employee whose ID is employee_id.

    Table: Salaries

    Column NameType
    employee_idint
    salaryint

    employee_id is the primary key for this table. Each row of this table indicates the salary of the employee whose ID is employee_id.

    Write an SQL query to report the IDs of all the employees with missing information. The information of an employee is missing if:

    • The employee’s name is missing, or
    • The employee’s salary is missing.

    Return the result table ordered by employee_id in ascending order.

    The query result format is in the following example.

  • 由于对计算机科学的热爱,以及有朝一日成为 「Bessie 博士」的诱惑,奶牛 Bessie 开始攻读计算机科学博士学位。

    经过一段时间的学术研究,她已经发表了 N 篇论文,并且她的第 i 篇论文得到了来自其他研究文献的 ci 次引用。

    Bessie 听说学术成就可以用 h 指数来衡量。

    h 指数等于使得研究员有至少 h 篇引用次数不少于 h 的论文的最大整数 h。

    例如,如果一名研究员有 4 篇论文,引用次数分别为 (1,100,2,3),则 h 指数为 2,然而若引用次数为 (1,100,3,3) 则 h 指数将会是 3。

    为了提升她的 h 指数,Bessie 计划写一篇综述,并引用一些她曾经写过的论文。

    由于页数限制,她至多可以在这篇综述中引用 L 篇论文,并且她只能引用每篇她的论文至多一次。

    请帮助 Bessie 求出在写完这篇综述后她可以达到的最大 h 指数。

    注意 Bessie 的导师可能会告知她纯粹为了提升 h 指数而写综述存在违反学术道德的嫌疑;我们不建议其他学者模仿 Bessie 的行为。

    acwing 简单 枚举 贪心 双指针 Created Thu, 17 Mar 2022 16:37:13 +0800
Next