mirror of
https://github.com/krishnadey30/LeetCode-Questions-CompanyWise.git
synced 2025-12-28 05:34:42 +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)
```
3.0 KiB
3.0 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 200 | Number of Islands | 46.8% | Medium | 0.6743216943898789 | https://leetcode.com/problems/number-of-islands |
| 3 | 695 | Max Area of Island | 62.7% | Medium | 0.5272157745378819 | https://leetcode.com/problems/max-area-of-island |
| 4 | 449 | Serialize and Deserialize BST | 52.0% | Medium | 0.5089777138955178 | https://leetcode.com/problems/serialize-and-deserialize-bst |
| 5 | 42 | Trapping Rain Water | 48.9% | Hard | 0.36187179404352093 | https://leetcode.com/problems/trapping-rain-water |
| 6 | 127 | Word Ladder | 29.6% | Medium | 0.29067608666438566 | https://leetcode.com/problems/word-ladder |
| 7 | 173 | Binary Search Tree Iterator | 56.6% | Medium | 0.2676620302183387 | https://leetcode.com/problems/binary-search-tree-iterator |
| 8 | 138 | Copy List with Random Pointer | 36.4% | Medium | 0.2330001096609468 | https://leetcode.com/problems/copy-list-with-random-pointer |
| 9 | 49 | Group Anagrams | 56.9% | Medium | 0.19424008455548245 | https://leetcode.com/problems/group-anagrams |
| 10 | 139 | Word Break | 40.1% | Medium | 0.1314440532234174 | https://leetcode.com/problems/word-break |
| 11 | 1041 | Robot Bounded In Circle | 49.6% | Medium | 0.10573219378884732 | https://leetcode.com/problems/robot-bounded-in-circle |
| 12 | 733 | Flood Fill | 55.3% | Easy | 0.09669362480247104 | https://leetcode.com/problems/flood-fill |
| 13 | 13 | Roman to Integer | 55.7% | Easy | 0.08237818622149326 | https://leetcode.com/problems/roman-to-integer |
| 14 | 103 | Binary Tree Zigzag Level Order Traversal | 48.3% | Medium | 0.08046023391882479 | https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal |
| 15 | 119 | Pascal's Triangle II | 49.0% | Easy | 0.07211890069342013 | https://leetcode.com/problems/pascals-triangle-ii |
| 16 | 332 | Reconstruct Itinerary | 36.7% | Medium | 0.053921416793820044 | https://leetcode.com/problems/reconstruct-itinerary |
| 17 | 15 | 3Sum | 26.8% | Medium | 0.04361391077370199 | https://leetcode.com/problems/3sum |
| 18 | 722 | Remove Comments | 34.6% | Medium | 0.04049136135473691 | https://leetcode.com/problems/remove-comments |
| 19 | 729 | My Calendar I | 51.8% | Medium | 0.036433902246102004 | https://leetcode.com/problems/my-calendar-i |
| 20 | 208 | Implement Trie (Prefix Tree) | 49.4% | Medium | 0.03593469952792866 | https://leetcode.com/problems/implement-trie-prefix-tree |
| 21 | 131 | Palindrome Partitioning | 47.5% | Medium | 0.03101558050692165 | https://leetcode.com/problems/palindrome-partitioning |
| 22 | 297 | Serialize and Deserialize Binary Tree | 47.5% | Hard | 0.01585377577217724 | https://leetcode.com/problems/serialize-and-deserialize-binary-tree |
| 23 | 767 | Reorganize String | 48.7% | Medium | 0.01329806830463147 | https://leetcode.com/problems/reorganize-string |
| 24 | 543 | Diameter of Binary Tree | 48.4% | Easy | 0.011898606798495848 | https://leetcode.com/problems/diameter-of-binary-tree |
| 25 | 69 | Sqrt(x) | 33.9% | Easy | 0.011443227222342794 | https://leetcode.com/problems/sqrtx |
| 26 | 295 | Find Median from Data Stream | 44.3% | Hard | 0.00899893586856953 | https://leetcode.com/problems/find-median-from-data-stream |
| 27 | 238 | Product of Array Except Self | 60.1% | Medium | 0.008821856860216758 | https://leetcode.com/problems/product-of-array-except-self |
| 28 | 34 | Find First and Last Position of Element in Sorted Array | 36.2% | Medium | 0.004247643638268045 | https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array |