zoukankan      html  css  js  c++  java
  • 哈希表(1598. 文件夹操作日志搜集器)

    其实也没啥,,但是为了算法的完备性我还是想写写,,,说实话我觉得可能是我理解的问题吧,哈希表可能没有这么,,,简单

     这个题没啥可说的,,,,,但是我可能需要截一下

    直接数组哈希哈哈哈哈哈哈哈,遍历2000

     1 #include <iostream>
     2 #include <cstdio>
     3 #include <cstring>
     4 #include <queue>
     5 
     6 using namespace std;
     7 const int N=10010,M=1000010;
     8 int head[N],ver[N],edge[M],Next[M],d[N],v[N];
     9 int n,m,tot=0;
    10 
    11 
    12 
    13 class Solution {
    14 public:
    15     bool uniqueOccurrences(vector<int>& arr) {
    16         int count[2002] = {0}; // 统计数字出现的频率
    17         for (int i = 0; i < arr.size(); i++) {
    18             count[arr[i] + 1000]++;
    19         }
    20         bool fre[1002] = {false}; // 看相同频率是否重复出现
    21         for (int i = 0; i <= 2000; i++) {
    22             if (count[i]) {
    23                 if (fre[count[i]] == false) fre[count[i]] = true;
    24                 else return false;
    25             }
    26         }
    27         return true;
    28     }
    29 };
  • 相关阅读:
    a*b高精度数组算法
    vscode plugins
    vscode keys
    vscode setting.jsonxx
    vscode settings.json
    webstorm keys
    vscode extensions
    vscode wechat settings.json
    vscode sass live compiler
    webstorm crack
  • 原文地址:https://www.cnblogs.com/zhmlzhml/p/13893291.html
Copyright © 2011-2022 走看看