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)
```
2.8 KiB
2.8 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 1290 | Convert Binary Number in a Linked List to Integer | 80.4% | Easy | 0.06956650156993308 | https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer |
| 3 | 1235 | Maximum Profit in Job Scheduling | 44.0% | Hard | 0.06732797308883445 | https://leetcode.com/problems/maximum-profit-in-job-scheduling |
| 4 | 909 | Snakes and Ladders | 38.4% | Medium | 0.06217455073507972 | https://leetcode.com/problems/snakes-and-ladders |
| 5 | 394 | Decode String | 50.0% | Medium | 0.04945278932693729 | https://leetcode.com/problems/decode-string |
| 6 | 91 | Decode Ways | 24.7% | Medium | 0.03673102791879485 | https://leetcode.com/problems/decode-ways |
| 7 | 198 | House Robber | 42.0% | Easy | 0.033320991026093004 | https://leetcode.com/problems/house-robber |
| 8 | 246 | Strobogrammatic Number | 45.0% | Easy | 0.032549659510785 | https://leetcode.com/problems/strobogrammatic-number |
| 9 | 56 | Merge Intervals | 39.3% | Medium | 0.02150990613527447 | https://leetcode.com/problems/merge-intervals |
| 10 | 53 | Maximum Subarray | 46.5% | Easy | 0.019336728821707075 | https://leetcode.com/problems/maximum-subarray |
| 11 | 450 | Delete Node in a BST | 43.1% | Medium | 0.018536211907915243 | https://leetcode.com/problems/delete-node-in-a-bst |
| 12 | 191 | Number of 1 Bits | 49.8% | Easy | 0.01673523624045844 | https://leetcode.com/problems/number-of-1-bits |
| 13 | 5 | Longest Palindromic Substring | 29.5% | Medium | 0.01416133329402493 | https://leetcode.com/problems/longest-palindromic-substring |
| 14 | 48 | Rotate Image | 56.7% | Medium | 0.011428695823622754 | https://leetcode.com/problems/rotate-image |
| 15 | 739 | Daily Temperatures | 63.3% | Medium | 0.010032690121814417 | https://leetcode.com/problems/daily-temperatures |
| 16 | 212 | Word Search II | 34.9% | Hard | 0.009845021678804893 | https://leetcode.com/problems/word-search-ii |
| 17 | 905 | Sort Array By Parity | 74.1% | Easy | 0.009603915354180344 | https://leetcode.com/problems/sort-array-by-parity |
| 18 | 49 | Group Anagrams | 56.9% | Medium | 0.008538951314232168 | https://leetcode.com/problems/group-anagrams |
| 19 | 1 | Two Sum | 45.6% | Easy | 0.0051178232035212715 | https://leetcode.com/problems/two-sum |
| 20 | 207 | Course Schedule | 43.1% | Medium | 0.004964021114211758 | https://leetcode.com/problems/course-schedule |
| 21 | 234 | Palindrome Linked List | 39.3% | Easy | 0.004533613114828982 | https://leetcode.com/problems/palindrome-linked-list |
| 22 | 22 | Generate Parentheses | 62.7% | Medium | 0.0043611059090124735 | https://leetcode.com/problems/generate-parentheses |
| 23 | 8 | String to Integer (atoi) | 15.4% | Medium | 0.0037925521897059712 | https://leetcode.com/problems/string-to-integer-atoi |
| 24 | 102 | Binary Tree Level Order Traversal | 54.6% | Medium | 0.003639014205004082 | https://leetcode.com/problems/binary-tree-level-order-traversal |
| 25 | 3 | Longest Substring Without Repeating Characters | 30.4% | Medium | 0.003496778759264278 | https://leetcode.com/problems/longest-substring-without-repeating-characters |
| 26 | 20 | Valid Parentheses | 39.0% | Easy | 0.0023005704055949323 | https://leetcode.com/problems/valid-parentheses |