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,15 +1,16 @@
|
||||
592,Fraction Addition and Subtraction,49.0%,Medium,2.1852914017256673, https://leetcode.com/problems/fraction-addition-and-subtraction
|
||||
691,Stickers to Spell Word,42.9%,Hard,1.614456743546043, https://leetcode.com/problems/stickers-to-spell-word
|
||||
598,Range Addition II,49.6%,Easy,1.5459245067117746, https://leetcode.com/problems/range-addition-ii
|
||||
634,Find the Derangement of An Array,40.1%,Medium,1.3910002521573033, https://leetcode.com/problems/find-the-derangement-of-an-array
|
||||
166,Fraction to Recurring Decimal,21.6%,Medium,1.1471239400937834, https://leetcode.com/problems/fraction-to-recurring-decimal
|
||||
697,Degree of an Array,53.8%,Easy,0.5762892819141592, https://leetcode.com/problems/degree-of-an-array
|
||||
717,1-bit and 2-bit Characters,48.8%,Easy,0.33241507811894616, https://leetcode.com/problems/1-bit-and-2-bit-characters
|
||||
14,Longest Common Prefix,35.4%,Easy,0.276319223139963, https://leetcode.com/problems/longest-common-prefix
|
||||
945,Minimum Increment to Make Array Unique,46.3%,Medium,0.26121549926361765, https://leetcode.com/problems/minimum-increment-to-make-array-unique
|
||||
234,Palindrome Linked List,39.3%,Easy,0.19278946654918988, https://leetcode.com/problems/palindrome-linked-list
|
||||
23,Merge k Sorted Lists,40.2%,Hard,0.1308579191643603, https://leetcode.com/problems/merge-k-sorted-lists
|
||||
227,Basic Calculator II,36.9%,Medium,0.07203574248429732, https://leetcode.com/problems/basic-calculator-ii
|
||||
518,Coin Change 2,50.2%,Medium,0.04656063549394753, https://leetcode.com/problems/coin-change-2
|
||||
33,Search in Rotated Sorted Array,34.5%,Medium,0.03732913608127183, https://leetcode.com/problems/search-in-rotated-sorted-array
|
||||
162,Find Peak Element,43.3%,Medium,0.013607709218149423, https://leetcode.com/problems/find-peak-element
|
||||
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
|
||||
592,Fraction Addition and Subtraction,49.0%,Medium,2.1852914017256673, https://leetcode.com/problems/fraction-addition-and-subtraction
|
||||
691,Stickers to Spell Word,42.9%,Hard,1.614456743546043, https://leetcode.com/problems/stickers-to-spell-word
|
||||
598,Range Addition II,49.6%,Easy,1.5459245067117746, https://leetcode.com/problems/range-addition-ii
|
||||
634,Find the Derangement of An Array,40.1%,Medium,1.3910002521573033, https://leetcode.com/problems/find-the-derangement-of-an-array
|
||||
166,Fraction to Recurring Decimal,21.6%,Medium,1.1471239400937834, https://leetcode.com/problems/fraction-to-recurring-decimal
|
||||
697,Degree of an Array,53.8%,Easy,0.5762892819141592, https://leetcode.com/problems/degree-of-an-array
|
||||
717,1-bit and 2-bit Characters,48.8%,Easy,0.33241507811894616, https://leetcode.com/problems/1-bit-and-2-bit-characters
|
||||
14,Longest Common Prefix,35.4%,Easy,0.276319223139963, https://leetcode.com/problems/longest-common-prefix
|
||||
945,Minimum Increment to Make Array Unique,46.3%,Medium,0.26121549926361765, https://leetcode.com/problems/minimum-increment-to-make-array-unique
|
||||
234,Palindrome Linked List,39.3%,Easy,0.19278946654918988, https://leetcode.com/problems/palindrome-linked-list
|
||||
23,Merge k Sorted Lists,40.2%,Hard,0.1308579191643603, https://leetcode.com/problems/merge-k-sorted-lists
|
||||
227,Basic Calculator II,36.9%,Medium,0.07203574248429732, https://leetcode.com/problems/basic-calculator-ii
|
||||
518,Coin Change 2,50.2%,Medium,0.04656063549394753, https://leetcode.com/problems/coin-change-2
|
||||
33,Search in Rotated Sorted Array,34.5%,Medium,0.03732913608127183, https://leetcode.com/problems/search-in-rotated-sorted-array
|
||||
162,Find Peak Element,43.3%,Medium,0.013607709218149423, https://leetcode.com/problems/find-peak-element
|
||||
|
||||
|
Reference in New Issue
Block a user