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.7 KiB
2.7 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 1 | Two Sum | 45.6% | Easy | 0.7025051399779716 | https://leetcode.com/problems/two-sum |
| 3 | 146 | LRU Cache | 33.2% | Medium | 0.521413265967313 | https://leetcode.com/problems/lru-cache |
| 4 | 72 | Edit Distance | 44.8% | Hard | 0.4324285917613152 | https://leetcode.com/problems/edit-distance |
| 5 | 2 | Add Two Numbers | 33.9% | Medium | 0.4221159733636152 | https://leetcode.com/problems/add-two-numbers |
| 6 | 33 | Search in Rotated Sorted Array | 34.5% | Medium | 0.31895461826361493 | https://leetcode.com/problems/search-in-rotated-sorted-array |
| 7 | 871 | Minimum Number of Refueling Stops | 31.4% | Hard | 0.2887275508533339 | https://leetcode.com/problems/minimum-number-of-refueling-stops |
| 8 | 3 | Longest Substring Without Repeating Characters | 30.4% | Medium | 0.2884992176890934 | https://leetcode.com/problems/longest-substring-without-repeating-characters |
| 9 | 70 | Climbing Stairs | 47.8% | Easy | 0.25415654925180287 | https://leetcode.com/problems/climbing-stairs |
| 10 | 215 | Kth Largest Element in an Array | 55.4% | Medium | 0.0730646752411442 | https://leetcode.com/problems/kth-largest-element-in-an-array |
| 11 | 88 | Merge Sorted Array | 39.4% | Easy | 0.0451990505469574 | https://leetcode.com/problems/merge-sorted-array |
| 12 | 240 | Search a 2D Matrix II | 43.2% | Medium | 0.044650273737738826 | https://leetcode.com/problems/search-a-2d-matrix-ii |
| 13 | 113 | Path Sum II | 46.7% | Medium | 0.03698133452871584 | https://leetcode.com/problems/path-sum-ii |
| 14 | 410 | Split Array Largest Sum | 44.5% | Hard | 0.02436174074003527 | https://leetcode.com/problems/split-array-largest-sum |
| 15 | 91 | Decode Ways | 24.7% | Medium | 0.0227930095285566 | https://leetcode.com/problems/decode-ways |
| 16 | 15 | 3Sum | 26.8% | Medium | 0.01857638557293541 | https://leetcode.com/problems/3sum |
| 17 | 124 | Binary Tree Maximum Path Sum | 34.3% | Hard | 0.005272883295230408 | https://leetcode.com/problems/binary-tree-maximum-path-sum |
| 18 | 543 | Diameter of Binary Tree | 48.4% | Easy | 0.005047966297304777 | https://leetcode.com/problems/diameter-of-binary-tree |
| 19 | 588 | Design In-Memory File System | 45.9% | Hard | 0 | https://leetcode.com/problems/design-in-memory-file-system |
| 20 | 397 | Integer Replacement | 32.9% | Medium | 0 | https://leetcode.com/problems/integer-replacement |
| 21 | 395 | Longest Substring with At Least K Repeating Characters | 41.4% | Medium | 0 | https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters |
| 22 | 413 | Arithmetic Slices | 57.9% | Medium | 0 | https://leetcode.com/problems/arithmetic-slices |
| 23 | 446 | Arithmetic Slices II - Subsequence | 32.7% | Hard | 0 | https://leetcode.com/problems/arithmetic-slices-ii-subsequence |
| 24 | 488 | Zuma Game | 39.9% | Hard | 0 | https://leetcode.com/problems/zuma-game |
| 25 | 576 | Out of Boundary Paths | 35.1% | Medium | 0 | https://leetcode.com/problems/out-of-boundary-paths |
| 26 | 873 | Length of Longest Fibonacci Subsequence | 48.0% | Medium | 0 | https://leetcode.com/problems/length-of-longest-fibonacci-subsequence |