mirror of
https://github.com/McSmog/LeetCode-Questions-CompanyWise.git
synced 2026-04-19 08:46:45 +00:00
## Description
- Add headers to all the CSV files
## Script used
```py
import csv
import os
# Set the path of the folder containing the CSV files
folder_path = "./LeetCode-Questions-CompanyWise"
headers = [
"ID",
"Title",
"Acceptance",
"Difficulty",
"Frequency",
"Leetcode Question Link",
]
# Loop through all the CSV files in the folder
for file_name in os.listdir(folder_path):
if file_name.endswith(".csv"):
# Read the CSV file into a list of rows
file_path = os.path.join(folder_path, file_name)
with open(file_path, "r") as f:
reader = csv.reader(f)
rows = list(reader)
has_headers = False
if len(rows) > 0 and rows[0] == headers:
has_headers = True
if not has_headers:
rows.insert(0, headers)
# Write the list of rows back to the CSV file
with open(file_path, "w", newline="") as f:
writer = csv.writer(f)
writer.writerows(rows)
```
4.7 KiB
4.7 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 759 | Employee Free Time | 66.3% | Hard | 2.6397139923561346 | https://leetcode.com/problems/employee-free-time |
| 3 | 811 | Subdomain Visit Count | 69.9% | Easy | 1.9912475836494699 | https://leetcode.com/problems/subdomain-visit-count |
| 4 | 277 | Find the Celebrity | 41.8% | Medium | 1.6067213396798519 | https://leetcode.com/problems/find-the-celebrity |
| 5 | 770 | Basic Calculator IV | 48.1% | Hard | 0.9582549309731873 | https://leetcode.com/problems/basic-calculator-iv |
| 6 | 269 | Alien Dictionary | 33.3% | Hard | 0.6552836497974878 | https://leetcode.com/problems/alien-dictionary |
| 7 | 362 | Design Hit Counter | 63.7% | Medium | 0.6551596398987732 | https://leetcode.com/problems/design-hit-counter |
| 8 | 224 | Basic Calculator | 36.8% | Hard | 0.5668534552356532 | https://leetcode.com/problems/basic-calculator |
| 9 | 632 | Smallest Range Covering Elements from K Lists | 52.4% | Hard | 0.5071491490366821 | https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists |
| 10 | 68 | Text Justification | 27.7% | Hard | 0.37052394220493184 | https://leetcode.com/problems/text-justification |
| 11 | 564 | Find the Closest Palindrome | 19.7% | Hard | 0.3007541540191337 | https://leetcode.com/problems/find-the-closest-palindrome |
| 12 | 254 | Factor Combinations | 46.7% | Medium | 0.21357410029805904 | https://leetcode.com/problems/factor-combinations |
| 13 | 126 | Word Ladder II | 22.1% | Hard | 0.2008357460092558 | https://leetcode.com/problems/word-ladder-ii |
| 14 | 718 | Maximum Length of Repeated Subarray | 49.4% | Medium | 0.16528289916664798 | https://leetcode.com/problems/maximum-length-of-repeated-subarray |
| 15 | 146 | LRU Cache | 33.2% | Medium | 0.15357414478678588 | https://leetcode.com/problems/lru-cache |
| 16 | 158 | Read N Characters Given Read4 II - Call multiple times | 33.8% | Hard | 0.15348688956060175 | https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times |
| 17 | 772 | Basic Calculator III | 41.3% | Hard | 0.13720112151348504 | https://leetcode.com/problems/basic-calculator-iii |
| 18 | 202 | Happy Number | 50.4% | Easy | 0.11982401289364229 | https://leetcode.com/problems/happy-number |
| 19 | 392 | Is Subsequence | 49.2% | Easy | 0.07897107508821988 | https://leetcode.com/problems/is-subsequence |
| 20 | 341 | Flatten Nested List Iterator | 52.9% | Medium | 0.07763353611776078 | https://leetcode.com/problems/flatten-nested-list-iterator |
| 21 | 726 | Number of Atoms | 49.0% | Hard | 0.06371581438610768 | https://leetcode.com/problems/number-of-atoms |
| 22 | 428 | Serialize and Deserialize N-ary Tree | 59.4% | Hard | 0.06136894637629212 | https://leetcode.com/problems/serialize-and-deserialize-n-ary-tree |
| 23 | 295 | Find Median from Data Stream | 44.3% | Hard | 0.05495888428075748 | https://leetcode.com/problems/find-median-from-data-stream |
| 24 | 36 | Valid Sudoku | 48.7% | Medium | 0.04452302288876419 | https://leetcode.com/problems/valid-sudoku |
| 25 | 935 | Knight Dialer | 45.2% | Medium | 0.04445176257083384 | https://leetcode.com/problems/knight-dialer |
| 26 | 56 | Merge Intervals | 39.3% | Medium | 0.04173304225331761 | https://leetcode.com/problems/merge-intervals |
| 27 | 79 | Word Search | 35.6% | Medium | 0.0408086655410548 | https://leetcode.com/problems/word-search |
| 28 | 261 | Graph Valid Tree | 42.2% | Medium | 0.03683657735649026 | https://leetcode.com/problems/graph-valid-tree |
| 29 | 127 | Word Ladder | 29.6% | Medium | 0.03679590970204585 | https://leetcode.com/problems/word-ladder |
| 30 | 91 | Decode Ways | 24.7% | Medium | 0.023662742620848144 | https://leetcode.com/problems/decode-ways |
| 31 | 698 | Partition to K Equal Sum Subsets | 45.0% | Medium | 0.02109782896463587 | https://leetcode.com/problems/partition-to-k-equal-sum-subsets |
| 32 | 208 | Implement Trie (Prefix Tree) | 49.4% | Medium | 0.02037191321634931 | https://leetcode.com/problems/implement-trie-prefix-tree |
| 33 | 139 | Word Break | 40.1% | Medium | 0.015487677691351377 | https://leetcode.com/problems/word-break |
| 34 | 986 | Interval List Intersections | 67.3% | Medium | 0.011969023795320735 | https://leetcode.com/problems/interval-list-intersections |
| 35 | 236 | Lowest Common Ancestor of a Binary Tree | 45.7% | Medium | 0.010575891759058162 | https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree |
| 36 | 380 | Insert Delete GetRandom O(1) | 47.5% | Medium | 0.009820849864094454 | https://leetcode.com/problems/insert-delete-getrandom-o1 |
| 37 | 239 | Sliding Window Maximum | 43.0% | Hard | 0.007898935224534491 | https://leetcode.com/problems/sliding-window-maximum |
| 38 | 14 | Longest Common Prefix | 35.4% | Easy | 0.00745530292090591 | https://leetcode.com/problems/longest-common-prefix |
| 39 | 210 | Course Schedule II | 40.7% | Medium | 0.0042893974831731225 | https://leetcode.com/problems/course-schedule-ii |
| 40 | 140 | Word Break II | 32.6% | Hard | 0.0027070942357783584 | https://leetcode.com/problems/word-break-ii |
| 41 | 621 | Task Scheduler | 50.1% | Medium | 0.002341784338144407 | https://leetcode.com/problems/task-scheduler |
| 42 | 571 | Find Median Given Frequency of Numbers | 44.7% | Hard | 0 | https://leetcode.com/problems/find-median-given-frequency-of-numbers |
| 43 | 720 | Longest Word in Dictionary | 48.2% | Easy | 0 | https://leetcode.com/problems/longest-word-in-dictionary |