2283. Check if Number Has Equal Digit Count and Digit Value 發表於 2023-02-13 | 分類於 leetcode problemsolution1234567891011class Solution {public: bool digitCount(string num) { vector<int> his(10,0); for(char c:num) his[c-'0']++; for(int i=0;i<num.size();++i){ if(his[i] != num[i]-'0') return false; } return true; }}; analysis time complexity O(n) space complexity O(1)