docs: remove redundant documentation files and table of contents from README

This commit is contained in:
Prad Nukala
2026-07-11 16:09:06 -04:00
parent 25ef46e13b
commit d7dfa1e45a
7 changed files with 0 additions and 58 deletions
-7
View File
@@ -1,12 +1,5 @@
# LeetCode # LeetCode
<!--toc:start-->
- [LeetCode](#leetcode)
- [Introduction](#introduction)
- [Frequency Map + Sort-With-Tiebreaker](#frequency-map-sort-with-tiebreaker)
- [Event Emitter + Throttle](#event-emitter-throttle)
<!--toc:end-->
## Introduction ## Introduction
Day 1: Frequency map + sort-with-tiebreak until automatic (LC 1365, 1636, 451) Day 1: Frequency map + sort-with-tiebreak until automatic (LC 1365, 1636, 451)
-51
View File
@@ -1,51 +0,0 @@
# Leetcode 1365
<!--toc:start-->
- [Leetcode 1365](#leetcode-1365)
- [Creating a Frequancy Map](#creating-a-frequancy-map)
- [Hammer Tool](#hammer-tool)
<!--toc:end-->
```js
function reduceArray(nums) {
const sorted = [...nums].sort((a, b) => a - b)
return nums.map((x) => {
nums.indexOf(sorted[x])
})
}
```
## Creating a Frequancy Map
```js
function reduceArray(nums) {
const freqMap = new Map()
nums.forEach((x) => {
if (freqMap.has(x)) {
freqMap.set(x, freqMap.get(x) + 1)
} else {
freqMap.set(x, 1)
}
})
return Array.from(freqMap.entries()).map(([k, v]) => v)
}
```
### Hammer Tool
```js
function hammer(arrOrStr) {
const freq = {};
for (let item of arrOrStr) {
freq[item] = (freq[item] || 0) + 1;
}
// Then either:
// A. Return freq map
// B. Sort using freq
return arrOrStr.slice().sort((a, b) => {
if (freq[b] !== freq[a]) return freq[b] - freq[a]; // desc freq
return a < b ? -1 : 1; // tiebreaker
});
}
```
View File
View File
View File
View File
View File