mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-07 08:21:41 +08:00
update
This commit is contained in:
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"20.8K\", \"totalSubmission\": \"33.7K\", \"totalAcceptedRaw\": 20752, \"totalSubmissionRaw\": 33673, \"acRate\": \"61.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"20.8K\", \"totalSubmission\": \"33.7K\", \"totalAcceptedRaw\": 20757, \"totalSubmissionRaw\": 33681, \"acRate\": \"61.6%\"}",
|
||||
"hints": [
|
||||
"Find the dominant element of nums by using a hashmap to maintain element frequency, we denote the dominant element as x and its frequency as f.",
|
||||
"For each index in [0, n - 2], calculate f1, x’s frequency in the subarray [0, i] when looping the index. And f2, x’s frequency in the subarray [i + 1, n - 1] which is equal to f - f1. Then we can check whether x is dominant in both subarrays."
|
||||
|
Reference in New Issue
Block a user