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)
```
2.9 KiB
2.9 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 735 | Asteroid Collision | 41.0% | Medium | 1.473090540195022 | https://leetcode.com/problems/asteroid-collision |
| 3 | 238 | Product of Array Except Self | 60.1% | Medium | 1.0067649782470638 | https://leetcode.com/problems/product-of-array-except-self |
| 4 | 365 | Water and Jug Problem | 30.6% | Medium | 0.8801037398580485 | https://leetcode.com/problems/water-and-jug-problem |
| 5 | 981 | Time Based Key-Value Store | 53.1% | Medium | 0.8180951326968029 | https://leetcode.com/problems/time-based-key-value-store |
| 6 | 158 | Read N Characters Given Read4 II - Call multiple times | 33.8% | Hard | 0.752091950433346 | https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times |
| 7 | 716 | Max Stack | 42.6% | Easy | 0.6330336058902137 | https://leetcode.com/problems/max-stack |
| 8 | 127 | Word Ladder | 29.6% | Medium | 0.1667080439422554 | https://leetcode.com/problems/word-ladder |
| 9 | 642 | Design Search Autocomplete System | 44.7% | Hard | 0.16312782492496253 | https://leetcode.com/problems/design-search-autocomplete-system |
| 10 | 426 | Convert Binary Search Tree to Sorted Doubly Linked List | 59.1% | Medium | 0.09352605801082346 | https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list |
| 11 | 109 | Convert Sorted List to Binary Search Tree | 47.7% | Medium | 0.08701137698962977 | https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree |
| 12 | 76 | Minimum Window Substring | 34.6% | Hard | 0.05473322196089386 | https://leetcode.com/problems/minimum-window-substring |
| 13 | 304 | Range Sum Query 2D - Immutable | 38.6% | Medium | 0.054527987071175225 | https://leetcode.com/problems/range-sum-query-2d-immutable |
| 14 | 91 | Decode Ways | 24.7% | Medium | 0.03673102791879485 | https://leetcode.com/problems/decode-ways |
| 15 | 1060 | Missing Element in Sorted Array | 54.5% | Medium | 0.017429635135283658 | https://leetcode.com/problems/missing-element-in-sorted-array |
| 16 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.016108271385328228 | https://leetcode.com/problems/merge-k-sorted-lists |
| 17 | 10 | Regular Expression Matching | 26.8% | Hard | 0.01609764684284749 | https://leetcode.com/problems/regular-expression-matching |
| 18 | 567 | Permutation in String | 44.4% | Medium | 0.014947961435873182 | https://leetcode.com/problems/permutation-in-string |
| 19 | 88 | Merge Sorted Array | 39.4% | Easy | 0.011986958032982505 | https://leetcode.com/problems/merge-sorted-array |
| 20 | 48 | Rotate Image | 56.7% | Medium | 0.011428695823622754 | https://leetcode.com/problems/rotate-image |
| 21 | 20 | Valid Parentheses | 39.0% | Easy | 0.009170695326061695 | https://leetcode.com/problems/valid-parentheses |
| 22 | 253 | Meeting Rooms II | 45.7% | Medium | 0.008079219870546493 | https://leetcode.com/problems/meeting-rooms-ii |
| 23 | 349 | Intersection of Two Arrays | 62.5% | Easy | 0.00725034896230682 | https://leetcode.com/problems/intersection-of-two-arrays |
| 24 | 146 | LRU Cache | 33.2% | Medium | 0.004600353139061353 | https://leetcode.com/problems/lru-cache |
| 25 | 17 | Letter Combinations of a Phone Number | 46.8% | Medium | 0.0044018999217624675 | https://leetcode.com/problems/letter-combinations-of-a-phone-number |