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,24 +1,25 @@
|
||||
223,Rectangle Area,37.8%,Medium,0.03472475285136202, https://leetcode.com/problems/rectangle-area
|
||||
146,LRU Cache,33.2%,Medium,0.029400237820807563, https://leetcode.com/problems/lru-cache
|
||||
231,Power of Two,43.7%,Easy,0.027132070647773038, https://leetcode.com/problems/power-of-two
|
||||
939,Minimum Area Rectangle,51.8%,Medium,0.02676703519877789, https://leetcode.com/problems/minimum-area-rectangle
|
||||
206,Reverse Linked List,62.5%,Easy,0.02086427467076072, https://leetcode.com/problems/reverse-linked-list
|
||||
97,Interleaving String,31.5%,Hard,0.020471543980187256, https://leetcode.com/problems/interleaving-string
|
||||
33,Search in Rotated Sorted Array,34.5%,Medium,0.0200182839715896, https://leetcode.com/problems/search-in-rotated-sorted-array
|
||||
706,Design HashMap,61.3%,Easy,0.01752893260576219, https://leetcode.com/problems/design-hashmap
|
||||
22,Generate Parentheses,62.7%,Medium,0.017331456351639924, https://leetcode.com/problems/generate-parentheses
|
||||
48,Rotate Image,56.7%,Medium,0.011428695823622754, https://leetcode.com/problems/rotate-image
|
||||
739,Daily Temperatures,63.3%,Medium,0.010032690121814417, https://leetcode.com/problems/daily-temperatures
|
||||
415,Add Strings,47.5%,Easy,0.007587289812159497, https://leetcode.com/problems/add-strings
|
||||
1,Two Sum,45.6%,Easy,0.0073613942765888805, https://leetcode.com/problems/two-sum
|
||||
114,Flatten Binary Tree to Linked List,49.3%,Medium,0.006896579059060353, https://leetcode.com/problems/flatten-binary-tree-to-linked-list
|
||||
64,Minimum Path Sum,54.5%,Medium,0.006127470152097104, https://leetcode.com/problems/minimum-path-sum
|
||||
199,Binary Tree Right Side View,54.1%,Medium,0.0056826406650506926, https://leetcode.com/problems/binary-tree-right-side-view
|
||||
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
|
||||
23,Merge k Sorted Lists,40.2%,Hard,0.004051459000748015, https://leetcode.com/problems/merge-k-sorted-lists
|
||||
8,String to Integer (atoi),15.4%,Medium,0.0037925521897059712, https://leetcode.com/problems/string-to-integer-atoi
|
||||
151,Reverse Words in a String,21.9%,Medium,0.003456091915988908, https://leetcode.com/problems/reverse-words-in-a-string
|
||||
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
|
||||
53,Maximum Subarray,46.5%,Easy,0.002167082872150794, https://leetcode.com/problems/maximum-subarray
|
||||
2,Add Two Numbers,33.9%,Medium,0.0016886191111440908, https://leetcode.com/problems/add-two-numbers
|
||||
70,Climbing Stairs,47.8%,Easy,0.0015084665529624085, https://leetcode.com/problems/climbing-stairs
|
||||
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
|
||||
223,Rectangle Area,37.8%,Medium,0.03472475285136202, https://leetcode.com/problems/rectangle-area
|
||||
146,LRU Cache,33.2%,Medium,0.029400237820807563, https://leetcode.com/problems/lru-cache
|
||||
231,Power of Two,43.7%,Easy,0.027132070647773038, https://leetcode.com/problems/power-of-two
|
||||
939,Minimum Area Rectangle,51.8%,Medium,0.02676703519877789, https://leetcode.com/problems/minimum-area-rectangle
|
||||
206,Reverse Linked List,62.5%,Easy,0.02086427467076072, https://leetcode.com/problems/reverse-linked-list
|
||||
97,Interleaving String,31.5%,Hard,0.020471543980187256, https://leetcode.com/problems/interleaving-string
|
||||
33,Search in Rotated Sorted Array,34.5%,Medium,0.0200182839715896, https://leetcode.com/problems/search-in-rotated-sorted-array
|
||||
706,Design HashMap,61.3%,Easy,0.01752893260576219, https://leetcode.com/problems/design-hashmap
|
||||
22,Generate Parentheses,62.7%,Medium,0.017331456351639924, https://leetcode.com/problems/generate-parentheses
|
||||
48,Rotate Image,56.7%,Medium,0.011428695823622754, https://leetcode.com/problems/rotate-image
|
||||
739,Daily Temperatures,63.3%,Medium,0.010032690121814417, https://leetcode.com/problems/daily-temperatures
|
||||
415,Add Strings,47.5%,Easy,0.007587289812159497, https://leetcode.com/problems/add-strings
|
||||
1,Two Sum,45.6%,Easy,0.0073613942765888805, https://leetcode.com/problems/two-sum
|
||||
114,Flatten Binary Tree to Linked List,49.3%,Medium,0.006896579059060353, https://leetcode.com/problems/flatten-binary-tree-to-linked-list
|
||||
64,Minimum Path Sum,54.5%,Medium,0.006127470152097104, https://leetcode.com/problems/minimum-path-sum
|
||||
199,Binary Tree Right Side View,54.1%,Medium,0.0056826406650506926, https://leetcode.com/problems/binary-tree-right-side-view
|
||||
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
|
||||
23,Merge k Sorted Lists,40.2%,Hard,0.004051459000748015, https://leetcode.com/problems/merge-k-sorted-lists
|
||||
8,String to Integer (atoi),15.4%,Medium,0.0037925521897059712, https://leetcode.com/problems/string-to-integer-atoi
|
||||
151,Reverse Words in a String,21.9%,Medium,0.003456091915988908, https://leetcode.com/problems/reverse-words-in-a-string
|
||||
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
|
||||
53,Maximum Subarray,46.5%,Easy,0.002167082872150794, https://leetcode.com/problems/maximum-subarray
|
||||
2,Add Two Numbers,33.9%,Medium,0.0016886191111440908, https://leetcode.com/problems/add-two-numbers
|
||||
70,Climbing Stairs,47.8%,Easy,0.0015084665529624085, https://leetcode.com/problems/climbing-stairs
|
||||
|
||||
|
Reference in New Issue
Block a user