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,17 +1,18 @@
|
||||
695,Max Area of Island,62.7%,Medium,0.09988789637571764, https://leetcode.com/problems/max-area-of-island
|
||||
127,Word Ladder,29.6%,Medium,0.06918942849168566, https://leetcode.com/problems/word-ladder
|
||||
42,Trapping Rain Water,48.9%,Hard,0.038490960607653675, https://leetcode.com/problems/trapping-rain-water
|
||||
729,My Calendar I,51.8%,Medium,0.036433902246102004, https://leetcode.com/problems/my-calendar-i
|
||||
139,Word Break,40.1%,Medium,0.03451593709018879, https://leetcode.com/problems/word-break
|
||||
332,Reconstruct Itinerary,36.7%,Medium,0.030687713231237448, https://leetcode.com/problems/reconstruct-itinerary
|
||||
138,Copy List with Random Pointer,36.4%,Medium,0.02453734514188008, https://leetcode.com/problems/copy-list-with-random-pointer
|
||||
103,Binary Tree Zigzag Level Order Traversal,48.3%,Medium,0.020730076462920684, https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
|
||||
173,Binary Search Tree Iterator,56.6%,Medium,0.01899993824490396, https://leetcode.com/problems/binary-search-tree-iterator
|
||||
131,Palindrome Partitioning,47.5%,Medium,0.013903595538577326, https://leetcode.com/problems/palindrome-partitioning
|
||||
767,Reorganize String,48.7%,Medium,0.01329806830463147, https://leetcode.com/problems/reorganize-string
|
||||
733,Flood Fill,55.3%,Easy,0.011217167530924988, https://leetcode.com/problems/flood-fill
|
||||
208,Implement Trie (Prefix Tree),49.4%,Medium,0.009105457856626612, https://leetcode.com/problems/implement-trie-prefix-tree
|
||||
238,Product of Array Except Self,60.1%,Medium,0.008821856860216758, https://leetcode.com/problems/product-of-array-except-self
|
||||
13,Roman to Integer,55.7%,Easy,0.007698267425752388, https://leetcode.com/problems/roman-to-integer
|
||||
200,Number of Islands,46.8%,Medium,0.006490251382779317, https://leetcode.com/problems/number-of-islands
|
||||
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
|
||||
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
|
||||
695,Max Area of Island,62.7%,Medium,0.09988789637571764, https://leetcode.com/problems/max-area-of-island
|
||||
127,Word Ladder,29.6%,Medium,0.06918942849168566, https://leetcode.com/problems/word-ladder
|
||||
42,Trapping Rain Water,48.9%,Hard,0.038490960607653675, https://leetcode.com/problems/trapping-rain-water
|
||||
729,My Calendar I,51.8%,Medium,0.036433902246102004, https://leetcode.com/problems/my-calendar-i
|
||||
139,Word Break,40.1%,Medium,0.03451593709018879, https://leetcode.com/problems/word-break
|
||||
332,Reconstruct Itinerary,36.7%,Medium,0.030687713231237448, https://leetcode.com/problems/reconstruct-itinerary
|
||||
138,Copy List with Random Pointer,36.4%,Medium,0.02453734514188008, https://leetcode.com/problems/copy-list-with-random-pointer
|
||||
103,Binary Tree Zigzag Level Order Traversal,48.3%,Medium,0.020730076462920684, https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
|
||||
173,Binary Search Tree Iterator,56.6%,Medium,0.01899993824490396, https://leetcode.com/problems/binary-search-tree-iterator
|
||||
131,Palindrome Partitioning,47.5%,Medium,0.013903595538577326, https://leetcode.com/problems/palindrome-partitioning
|
||||
767,Reorganize String,48.7%,Medium,0.01329806830463147, https://leetcode.com/problems/reorganize-string
|
||||
733,Flood Fill,55.3%,Easy,0.011217167530924988, https://leetcode.com/problems/flood-fill
|
||||
208,Implement Trie (Prefix Tree),49.4%,Medium,0.009105457856626612, https://leetcode.com/problems/implement-trie-prefix-tree
|
||||
238,Product of Array Except Self,60.1%,Medium,0.008821856860216758, https://leetcode.com/problems/product-of-array-except-self
|
||||
13,Roman to Integer,55.7%,Easy,0.007698267425752388, https://leetcode.com/problems/roman-to-integer
|
||||
200,Number of Islands,46.8%,Medium,0.006490251382779317, https://leetcode.com/problems/number-of-islands
|
||||
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
|
||||
|
||||
|
Reference in New Issue
Block a user