mirror of
https://github.com/McSmog/LeetCode-Questions-CompanyWise.git
synced 2026-04-19 16:56: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)
```
2.7 KiB
2.7 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 706 | Design HashMap | 61.3% | Easy | 0.03655310240265549 | https://leetcode.com/problems/design-hashmap |
| 3 | 653 | Two Sum IV - Input is a BST | 55.5% | Easy | 0.02926276273740802 | https://leetcode.com/problems/two-sum-iv-input-is-a-bst |
| 4 | 867 | Transpose Matrix | 62.8% | Easy | 0.028715904834557722 | https://leetcode.com/problems/transpose-matrix |
| 5 | 921 | Minimum Add to Make Parentheses Valid | 73.7% | Medium | 0.021425565169310254 | https://leetcode.com/problems/minimum-add-to-make-parentheses-valid |
| 6 | 1 | Two Sum | 45.6% | Easy | 0.016487580637467636 | https://leetcode.com/problems/two-sum |
| 7 | 1290 | Convert Binary Number in a Linked List to Integer | 80.4% | Easy | 0.010568130061792257 | https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer |
| 8 | 17 | Letter Combinations of a Phone Number | 46.8% | Medium | 0.00987716546167603 | https://leetcode.com/problems/letter-combinations-of-a-phone-number |
| 9 | 20 | Valid Parentheses | 39.0% | Easy | 0.009170695326061695 | https://leetcode.com/problems/valid-parentheses |
| 10 | 5 | Longest Palindromic Substring | 29.5% | Medium | 0.009086325220960808 | https://leetcode.com/problems/longest-palindromic-substring |
| 11 | 49 | Group Anagrams | 56.9% | Medium | 0.008538951314232168 | https://leetcode.com/problems/group-anagrams |
| 12 | 56 | Merge Intervals | 39.3% | Medium | 0.007796972706004796 | https://leetcode.com/problems/merge-intervals |
| 13 | 2 | Add Two Numbers | 33.9% | Medium | 0.006737434951993369 | https://leetcode.com/problems/add-two-numbers |
| 14 | 127 | Word Ladder | 29.6% | Medium | 0.005979091056058075 | https://leetcode.com/problems/word-ladder |
| 15 | 268 | Missing Number | 51.7% | Easy | 0.0048804391649084865 | https://leetcode.com/problems/missing-number |
| 16 | 155 | Min Stack | 44.5% | Easy | 0.00474891074128171 | https://leetcode.com/problems/min-stack |
| 17 | 42 | Trapping Rain Water | 48.9% | Hard | 0.004350670338744988 | https://leetcode.com/problems/trapping-rain-water |
| 18 | 387 | First Unique Character in a String | 53.4% | Easy | 0.00418541994270691 | https://leetcode.com/problems/first-unique-character-in-a-string |
| 19 | 242 | Valid Anagram | 56.9% | Easy | 0.004154123743115972 | https://leetcode.com/problems/valid-anagram |
| 20 | 238 | Product of Array Except Self | 60.1% | Medium | 0.003930436424724545 | https://leetcode.com/problems/product-of-array-except-self |
| 21 | 103 | Binary Tree Zigzag Level Order Traversal | 48.3% | Medium | 0.003839922800048048 | https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal |
| 22 | 344 | Reverse String | 68.5% | Easy | 0.003269579502519813 | https://leetcode.com/problems/reverse-string |
| 23 | 200 | Number of Islands | 46.8% | Medium | 0.0028897578265903614 | https://leetcode.com/problems/number-of-islands |
| 24 | 15 | 3Sum | 26.8% | Medium | 0.0021990113314367685 | https://leetcode.com/problems/3sum |
| 25 | 26 | Remove Duplicates from Sorted Array | 45.1% | Easy | 0.0019513153174351963 | https://leetcode.com/problems/remove-duplicates-from-sorted-array |