diff --git a/.idea/.idea.Leetcode/.idea/workspace.xml b/.idea/.idea.Leetcode/.idea/workspace.xml
index 1c355c4..6fcef90 100644
--- a/.idea/.idea.Leetcode/.idea/workspace.xml
+++ b/.idea/.idea.Leetcode/.idea/workspace.xml
@@ -89,11 +89,9 @@
-
-
-
+
-
+
@@ -125,33 +123,34 @@
- {
- "keyToString": {
- ".NET Project.14. Longest Common Prefix.executor": "Run",
- ".NET Project.150. Evaluate Reverse Polish Notation.executor": "Run",
- ".NET Project.9. Palindrome Number.executor": "Run",
- "ASKED_ADD_EXTERNAL_FILES": "true",
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "WebServerToolWindowFactoryState": "false",
- "git-widget-placeholder": "main",
- "last_opened_file_path": "/home/nullptr/Projects/dotnet/Leetcode/15. 3Sum/15. 3Sum.csproj",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "settings.editor.selected.configurable": "SolutionBuilderGeneralOptionsPage",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
@@ -1702,7 +1701,7 @@
-
+
diff --git a/451. Sort Characters By Frequency/Fast/FastSolution.cs b/451. Sort Characters By Frequency/Fast/FastSolution.cs
new file mode 100644
index 0000000..b024f3b
--- /dev/null
+++ b/451. Sort Characters By Frequency/Fast/FastSolution.cs
@@ -0,0 +1,26 @@
+using System.Text;
+
+namespace _451._Sort_Characters_By_Frequency.Fast;
+
+public class Solution
+{
+ private static int Comparer((char, int) el1, (char, int) el2)
+ {
+ return el2.Item2.CompareTo(el1.Item2);
+ }
+
+ public string FrequencySort(string s)
+ {
+ var count = new (char, int)[128];
+ for (var ch = (char)0; ch < count.Length; ch++)
+ count[ch].Item1 = ch;
+ foreach (var c in s)
+ count[c].Item2++;
+ var sb = new StringBuilder();
+ Array.Sort(count, Comparer);
+ for (var ch = (char)0; ch < count.Length; ch++)
+ while (count[ch].Item2-- > 0)
+ sb.Append(count[ch].Item1);
+ return sb.ToString();
+ }
+}
\ No newline at end of file
diff --git a/451. Sort Characters By Frequency/Program.cs b/451. Sort Characters By Frequency/Program.cs
index 9967c7b..04fb8eb 100644
--- a/451. Sort Characters By Frequency/Program.cs
+++ b/451. Sort Characters By Frequency/Program.cs
@@ -1,4 +1,4 @@
using _451._Sort_Characters_By_Frequency;
-var sol = new Solution();
+var sol = new _451._Sort_Characters_By_Frequency.Fast.Solution();
Console.WriteLine(sol.FrequencySort("gbngjaaaaaaaafsdgnjk;fdsnjkg;fds"));
\ No newline at end of file