mirror of
https://github.com/McSmog/LeetCode-Questions-CompanyWise.git
synced 2026-04-19 16:56:45 +00:00
Chore: Add headers to all the files (#54)
## 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)
```
This commit is contained in:
committed by
GitHub
parent
0aeadbd612
commit
fb5f78b55e
@@ -1,12 +1,13 @@
|
||||
736,Parse Lisp Expression,47.5%,Hard,0.7290367865107017, https://leetcode.com/problems/parse-lisp-expression
|
||||
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.49586980740929654, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
|
||||
695,Max Area of Island,62.7%,Medium,0.31425595727716876, https://leetcode.com/problems/max-area-of-island
|
||||
380,Insert Delete GetRandom O(1),47.5%,Medium,0.08108897817576358, https://leetcode.com/problems/insert-delete-getrandom-o1
|
||||
49,Group Anagrams,56.9%,Medium,0.05662724563684648, https://leetcode.com/problems/group-anagrams
|
||||
200,Number of Islands,46.8%,Medium,0.033359117749874545, https://leetcode.com/problems/number-of-islands
|
||||
362,Design Hit Counter,63.7%,Medium,0.024317307650706343, https://leetcode.com/problems/design-hit-counter
|
||||
322,Coin Change,35.5%,Medium,0.008671409957551127, https://leetcode.com/problems/coin-change
|
||||
230,Kth Smallest Element in a BST,60.2%,Medium,0.006085520073802784, https://leetcode.com/problems/kth-smallest-element-in-a-bst
|
||||
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
|
||||
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
|
||||
1,Two Sum,45.6%,Easy,0.003139596786381058, https://leetcode.com/problems/two-sum
|
||||
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
|
||||
736,Parse Lisp Expression,47.5%,Hard,0.7290367865107017, https://leetcode.com/problems/parse-lisp-expression
|
||||
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.49586980740929654, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
|
||||
695,Max Area of Island,62.7%,Medium,0.31425595727716876, https://leetcode.com/problems/max-area-of-island
|
||||
380,Insert Delete GetRandom O(1),47.5%,Medium,0.08108897817576358, https://leetcode.com/problems/insert-delete-getrandom-o1
|
||||
49,Group Anagrams,56.9%,Medium,0.05662724563684648, https://leetcode.com/problems/group-anagrams
|
||||
200,Number of Islands,46.8%,Medium,0.033359117749874545, https://leetcode.com/problems/number-of-islands
|
||||
362,Design Hit Counter,63.7%,Medium,0.024317307650706343, https://leetcode.com/problems/design-hit-counter
|
||||
322,Coin Change,35.5%,Medium,0.008671409957551127, https://leetcode.com/problems/coin-change
|
||||
230,Kth Smallest Element in a BST,60.2%,Medium,0.006085520073802784, https://leetcode.com/problems/kth-smallest-element-in-a-bst
|
||||
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
|
||||
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
|
||||
1,Two Sum,45.6%,Easy,0.003139596786381058, https://leetcode.com/problems/two-sum
|
||||
|
||||
|
Reference in New Issue
Block a user