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,22 +1,23 @@
|
||||
202,Happy Number,50.4%,Easy,2.788803446881718, https://leetcode.com/problems/happy-number
|
||||
20,Valid Parentheses,39.0%,Easy,1.5639916071962492, https://leetcode.com/problems/valid-parentheses
|
||||
322,Coin Change,35.5%,Medium,0.3391797675107801, https://leetcode.com/problems/coin-change
|
||||
1328,Break a Palindrome,43.3%,Medium,0.05910139227591337, https://leetcode.com/problems/break-a-palindrome
|
||||
9,Palindrome Number,48.4%,Easy,0.03659309116122965, https://leetcode.com/problems/palindrome-number
|
||||
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.033453179586686504, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
|
||||
273,Integer to English Words,27.1%,Hard,0.026980053764546055, https://leetcode.com/problems/integer-to-english-words
|
||||
53,Maximum Subarray,46.5%,Easy,0.019336728821707075, https://leetcode.com/problems/maximum-subarray
|
||||
7,Reverse Integer,25.8%,Easy,0.016627790608488954, https://leetcode.com/problems/reverse-integer
|
||||
31,Next Permutation,32.6%,Medium,0.013427025530888667, https://leetcode.com/problems/next-permutation
|
||||
200,Number of Islands,46.8%,Medium,0.011509262420590827, https://leetcode.com/problems/number-of-islands
|
||||
146,LRU Cache,33.2%,Medium,0.010321192540274932, https://leetcode.com/problems/lru-cache
|
||||
17,Letter Combinations of a Phone Number,46.8%,Medium,0.00987716546167603, https://leetcode.com/problems/letter-combinations-of-a-phone-number
|
||||
349,Intersection of Two Arrays,62.5%,Easy,0.00725034896230682, https://leetcode.com/problems/intersection-of-two-arrays
|
||||
39,Combination Sum,56.1%,Medium,0.005715934396440999, https://leetcode.com/problems/combination-sum
|
||||
387,First Unique Character in a String,53.4%,Easy,0.00418541994270691, https://leetcode.com/problems/first-unique-character-in-a-string
|
||||
215,Kth Largest Element in an Array,55.4%,Medium,0.003902443976931749, https://leetcode.com/problems/kth-largest-element-in-an-array
|
||||
4,Median of Two Sorted Arrays,29.6%,Hard,0.003900160950094767, https://leetcode.com/problems/median-of-two-sorted-arrays
|
||||
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
|
||||
33,Search in Rotated Sorted Array,34.5%,Medium,0.003229976968332634, https://leetcode.com/problems/search-in-rotated-sorted-array
|
||||
5,Longest Palindromic Substring,29.5%,Medium,0.002279333142507479, https://leetcode.com/problems/longest-palindromic-substring
|
||||
79,Word Search,35.6%,Medium,0.0016647248725526849, https://leetcode.com/problems/word-search
|
||||
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
|
||||
202,Happy Number,50.4%,Easy,2.788803446881718, https://leetcode.com/problems/happy-number
|
||||
20,Valid Parentheses,39.0%,Easy,1.5639916071962492, https://leetcode.com/problems/valid-parentheses
|
||||
322,Coin Change,35.5%,Medium,0.3391797675107801, https://leetcode.com/problems/coin-change
|
||||
1328,Break a Palindrome,43.3%,Medium,0.05910139227591337, https://leetcode.com/problems/break-a-palindrome
|
||||
9,Palindrome Number,48.4%,Easy,0.03659309116122965, https://leetcode.com/problems/palindrome-number
|
||||
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.033453179586686504, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
|
||||
273,Integer to English Words,27.1%,Hard,0.026980053764546055, https://leetcode.com/problems/integer-to-english-words
|
||||
53,Maximum Subarray,46.5%,Easy,0.019336728821707075, https://leetcode.com/problems/maximum-subarray
|
||||
7,Reverse Integer,25.8%,Easy,0.016627790608488954, https://leetcode.com/problems/reverse-integer
|
||||
31,Next Permutation,32.6%,Medium,0.013427025530888667, https://leetcode.com/problems/next-permutation
|
||||
200,Number of Islands,46.8%,Medium,0.011509262420590827, https://leetcode.com/problems/number-of-islands
|
||||
146,LRU Cache,33.2%,Medium,0.010321192540274932, https://leetcode.com/problems/lru-cache
|
||||
17,Letter Combinations of a Phone Number,46.8%,Medium,0.00987716546167603, https://leetcode.com/problems/letter-combinations-of-a-phone-number
|
||||
349,Intersection of Two Arrays,62.5%,Easy,0.00725034896230682, https://leetcode.com/problems/intersection-of-two-arrays
|
||||
39,Combination Sum,56.1%,Medium,0.005715934396440999, https://leetcode.com/problems/combination-sum
|
||||
387,First Unique Character in a String,53.4%,Easy,0.00418541994270691, https://leetcode.com/problems/first-unique-character-in-a-string
|
||||
215,Kth Largest Element in an Array,55.4%,Medium,0.003902443976931749, https://leetcode.com/problems/kth-largest-element-in-an-array
|
||||
4,Median of Two Sorted Arrays,29.6%,Hard,0.003900160950094767, https://leetcode.com/problems/median-of-two-sorted-arrays
|
||||
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
|
||||
33,Search in Rotated Sorted Array,34.5%,Medium,0.003229976968332634, https://leetcode.com/problems/search-in-rotated-sorted-array
|
||||
5,Longest Palindromic Substring,29.5%,Medium,0.002279333142507479, https://leetcode.com/problems/longest-palindromic-substring
|
||||
79,Word Search,35.6%,Medium,0.0016647248725526849, https://leetcode.com/problems/word-search
|
||||
|
||||
|
Reference in New Issue
Block a user