摘要:
1. 图中的最短环 广度优先搜索 class Solution { public: int findShortestCycle(int n, vector<vector<int>> &edges) { vector<vector<int>> g(n);//二维矩阵存储 for (auto &e: e 阅读全文
摘要:
####1. 返回尾零数量 可以转换为求质因子为2和5数量的较小值,实际上就是求质因子为5的数量 class Solution { public: int trailingZeroes(int n) { int ans = 0; for (int i = 5; i <= n; i += 5) //遍 阅读全文
摘要:
给定排序好的数组 arr ,两个整数 k 和 x ,从数组中找到最靠近 x(两数之差最小)的 k 个数。返回的结果必须要是按升序排好的 ####1. 通用调库解法 class Solution { public: vector<int> findClosestElements(vector<int> 阅读全文