上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 97 下一页
摘要: Problem Description Given a tree (a connected graph with no cycles), you have to find the farthest nodes in the tree. The edges... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 【定义】 给定一棵树,树中的每条边都有一个权值。 树中两点的距离:连接两点的路径边权之和树的直径:树中最远的两个节点之间的距离树的最长链:连接树中最远的两个结点的路径【实现】 树的直径通常有两种求法,时间复杂度均为O(n)。 假设树以 n 个点 n-1 条边的... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(39) 评论(0) 推荐(0) 编辑
摘要: Problem Description Nura wants to buy k gadgets. She has only s burles for that. She can buy each gadget for dollars or for pou... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(13) 评论(0) 推荐(0) 编辑
摘要: Problem Description Lavrenty, a baker, is going to make several buns with stuffings and sell them. Lavrenty has n grams of dou... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Problem Description 小度熊拿到了一个无序的数组,对于这个数组,小度熊想知道是否能找到一个k 的区间,里面的 k 个数字排完序后是连续的。 现在小度熊增加题目难度,他不想知道是否有这样的 k 的区间,而是想知道有几个这样的 k 的区间... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(15) 评论(0) 推荐(0) 编辑
摘要: Problem Description There is a tree(the tree is a connected graph which contains n points and n−1 edges),the points are labeled... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(41) 评论(0) 推荐(0) 编辑
摘要: Problem Description 度度熊是一只喜欢探险的熊,一次偶然落进了一个m*n矩阵的迷宫,该迷宫只能从矩阵左上角第一个方格开始走,只有走到右上角的第一个格子才算走出迷宫,每一次只能走一格,且只能向上向下向右走以前没有走过的格子,每一个格子中都... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(34) 评论(0) 推荐(0) 编辑
摘要: Problem Description A list of n integers are given. For an integer x you can do the following operations: + let the binary rep... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(12) 评论(0) 推荐(0) 编辑
摘要: Problem Description According to the Automobile Collision Monitor (ACM), most fatal traffic accidents occur on two-way streets.... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(13) 评论(0) 推荐(0) 编辑
摘要: Problem Description The Genographic Project is a research partnership between IBM and The National Geographic Society that is a... 阅读全文
posted @ 2022-09-20 23:00 老程序员111 阅读(20) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 97 下一页