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:
Krishna Kumar Dey
2023-04-01 11:07:49 +05:30
committed by GitHub
parent 0aeadbd612
commit fb5f78b55e
534 changed files with 20291 additions and 19757 deletions

View File

@@ -1,21 +1,22 @@
599,Minimum Index Sum of Two Lists,50.7%,Easy,0.4762677241497535, https://leetcode.com/problems/minimum-index-sum-of-two-lists
355,Design Twitter,30.3%,Medium,0.4013575056633937, https://leetcode.com/problems/design-twitter
1126,Active Businesses,68.5%,Medium,0.3208150073042144, https://leetcode.com/problems/active-businesses
692,Top K Frequent Words,51.8%,Medium,0.24027250894503516, https://leetcode.com/problems/top-k-frequent-words
564,Find the Closest Palindrome,19.7%,Hard,0.18012616623051897, https://leetcode.com/problems/find-the-closest-palindrome
347,Top K Frequent Elements,61.2%,Medium,0.1517903074513627, https://leetcode.com/problems/top-k-frequent-elements
528,Random Pick with Weight,43.9%,Medium,0.12617342152539626, https://leetcode.com/problems/random-pick-with-weight
192,Word Frequency,25.8%,Medium,0.10186917331721722, https://leetcode.com/problems/word-frequency
332,Reconstruct Itinerary,36.7%,Medium,0.08302143328026106, https://leetcode.com/problems/reconstruct-itinerary
253,Meeting Rooms II,45.7%,Medium,0.04945628059066218, https://leetcode.com/problems/meeting-rooms-ii
56,Merge Intervals,39.3%,Medium,0.030829638084076787, https://leetcode.com/problems/merge-intervals
273,Integer to English Words,27.1%,Hard,0.026980053764546055, https://leetcode.com/problems/integer-to-english-words
205,Isomorphic Strings,39.8%,Easy,0.011544139746865315, https://leetcode.com/problems/isomorphic-strings
380,Insert Delete GetRandom O(1),47.5%,Medium,0.009820849864094454, https://leetcode.com/problems/insert-delete-getrandom-o1
139,Word Break,40.1%,Medium,0.008741314401573542, https://leetcode.com/problems/word-break
239,Sliding Window Maximum,43.0%,Hard,0.007898935224534491, https://leetcode.com/problems/sliding-window-maximum
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
22,Generate Parentheses,62.7%,Medium,0.0043611059090124735, https://leetcode.com/problems/generate-parentheses
14,Longest Common Prefix,35.4%,Easy,0.003320331762984143, https://leetcode.com/problems/longest-common-prefix
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.0015556336509412823, https://leetcode.com/problems/longest-substring-without-repeating-characters
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
599,Minimum Index Sum of Two Lists,50.7%,Easy,0.4762677241497535, https://leetcode.com/problems/minimum-index-sum-of-two-lists
355,Design Twitter,30.3%,Medium,0.4013575056633937, https://leetcode.com/problems/design-twitter
1126,Active Businesses,68.5%,Medium,0.3208150073042144, https://leetcode.com/problems/active-businesses
692,Top K Frequent Words,51.8%,Medium,0.24027250894503516, https://leetcode.com/problems/top-k-frequent-words
564,Find the Closest Palindrome,19.7%,Hard,0.18012616623051897, https://leetcode.com/problems/find-the-closest-palindrome
347,Top K Frequent Elements,61.2%,Medium,0.1517903074513627, https://leetcode.com/problems/top-k-frequent-elements
528,Random Pick with Weight,43.9%,Medium,0.12617342152539626, https://leetcode.com/problems/random-pick-with-weight
192,Word Frequency,25.8%,Medium,0.10186917331721722, https://leetcode.com/problems/word-frequency
332,Reconstruct Itinerary,36.7%,Medium,0.08302143328026106, https://leetcode.com/problems/reconstruct-itinerary
253,Meeting Rooms II,45.7%,Medium,0.04945628059066218, https://leetcode.com/problems/meeting-rooms-ii
56,Merge Intervals,39.3%,Medium,0.030829638084076787, https://leetcode.com/problems/merge-intervals
273,Integer to English Words,27.1%,Hard,0.026980053764546055, https://leetcode.com/problems/integer-to-english-words
205,Isomorphic Strings,39.8%,Easy,0.011544139746865315, https://leetcode.com/problems/isomorphic-strings
380,Insert Delete GetRandom O(1),47.5%,Medium,0.009820849864094454, https://leetcode.com/problems/insert-delete-getrandom-o1
139,Word Break,40.1%,Medium,0.008741314401573542, https://leetcode.com/problems/word-break
239,Sliding Window Maximum,43.0%,Hard,0.007898935224534491, https://leetcode.com/problems/sliding-window-maximum
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
22,Generate Parentheses,62.7%,Medium,0.0043611059090124735, https://leetcode.com/problems/generate-parentheses
14,Longest Common Prefix,35.4%,Easy,0.003320331762984143, https://leetcode.com/problems/longest-common-prefix
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.0015556336509412823, https://leetcode.com/problems/longest-substring-without-repeating-characters
1 599 ID Minimum Index Sum of Two Lists Title 50.7% Acceptance Easy Difficulty 0.4762677241497535 Frequency https://leetcode.com/problems/minimum-index-sum-of-two-lists Leetcode Question Link
2 355 599 Design Twitter Minimum Index Sum of Two Lists 30.3% 50.7% Medium Easy 0.4013575056633937 0.4762677241497535 https://leetcode.com/problems/design-twitter https://leetcode.com/problems/minimum-index-sum-of-two-lists
3 1126 355 Active Businesses Design Twitter 68.5% 30.3% Medium Medium 0.3208150073042144 0.4013575056633937 https://leetcode.com/problems/active-businesses https://leetcode.com/problems/design-twitter
4 692 1126 Top K Frequent Words Active Businesses 51.8% 68.5% Medium Medium 0.24027250894503516 0.3208150073042144 https://leetcode.com/problems/top-k-frequent-words https://leetcode.com/problems/active-businesses
5 564 692 Find the Closest Palindrome Top K Frequent Words 19.7% 51.8% Hard Medium 0.18012616623051897 0.24027250894503516 https://leetcode.com/problems/find-the-closest-palindrome https://leetcode.com/problems/top-k-frequent-words
6 347 564 Top K Frequent Elements Find the Closest Palindrome 61.2% 19.7% Medium Hard 0.1517903074513627 0.18012616623051897 https://leetcode.com/problems/top-k-frequent-elements https://leetcode.com/problems/find-the-closest-palindrome
7 528 347 Random Pick with Weight Top K Frequent Elements 43.9% 61.2% Medium Medium 0.12617342152539626 0.1517903074513627 https://leetcode.com/problems/random-pick-with-weight https://leetcode.com/problems/top-k-frequent-elements
8 192 528 Word Frequency Random Pick with Weight 25.8% 43.9% Medium Medium 0.10186917331721722 0.12617342152539626 https://leetcode.com/problems/word-frequency https://leetcode.com/problems/random-pick-with-weight
9 332 192 Reconstruct Itinerary Word Frequency 36.7% 25.8% Medium Medium 0.08302143328026106 0.10186917331721722 https://leetcode.com/problems/reconstruct-itinerary https://leetcode.com/problems/word-frequency
10 253 332 Meeting Rooms II Reconstruct Itinerary 45.7% 36.7% Medium Medium 0.04945628059066218 0.08302143328026106 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/reconstruct-itinerary
11 56 253 Merge Intervals Meeting Rooms II 39.3% 45.7% Medium Medium 0.030829638084076787 0.04945628059066218 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/meeting-rooms-ii
12 273 56 Integer to English Words Merge Intervals 27.1% 39.3% Hard Medium 0.026980053764546055 0.030829638084076787 https://leetcode.com/problems/integer-to-english-words https://leetcode.com/problems/merge-intervals
13 205 273 Isomorphic Strings Integer to English Words 39.8% 27.1% Easy Hard 0.011544139746865315 0.026980053764546055 https://leetcode.com/problems/isomorphic-strings https://leetcode.com/problems/integer-to-english-words
14 380 205 Insert Delete GetRandom O(1) Isomorphic Strings 47.5% 39.8% Medium Easy 0.009820849864094454 0.011544139746865315 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/isomorphic-strings
15 139 380 Word Break Insert Delete GetRandom O(1) 40.1% 47.5% Medium Medium 0.008741314401573542 0.009820849864094454 https://leetcode.com/problems/word-break https://leetcode.com/problems/insert-delete-getrandom-o1
16 239 139 Sliding Window Maximum Word Break 43.0% 40.1% Hard Medium 0.007898935224534491 0.008741314401573542 https://leetcode.com/problems/sliding-window-maximum https://leetcode.com/problems/word-break
17 349 239 Intersection of Two Arrays Sliding Window Maximum 62.5% 43.0% Easy Hard 0.00725034896230682 0.007898935224534491 https://leetcode.com/problems/intersection-of-two-arrays https://leetcode.com/problems/sliding-window-maximum
18 39 349 Combination Sum Intersection of Two Arrays 56.1% 62.5% Medium Easy 0.005715934396440999 0.00725034896230682 https://leetcode.com/problems/combination-sum https://leetcode.com/problems/intersection-of-two-arrays
19 22 39 Generate Parentheses Combination Sum 62.7% 56.1% Medium Medium 0.0043611059090124735 0.005715934396440999 https://leetcode.com/problems/generate-parentheses https://leetcode.com/problems/combination-sum
20 14 22 Longest Common Prefix Generate Parentheses 35.4% 62.7% Easy Medium 0.003320331762984143 0.0043611059090124735 https://leetcode.com/problems/longest-common-prefix https://leetcode.com/problems/generate-parentheses
21 3 14 Longest Substring Without Repeating Characters Longest Common Prefix 30.4% 35.4% Medium Easy 0.0015556336509412823 0.003320331762984143 https://leetcode.com/problems/longest-substring-without-repeating-characters https://leetcode.com/problems/longest-common-prefix
22 3 Longest Substring Without Repeating Characters 30.4% Medium 0.0015556336509412823 https://leetcode.com/problems/longest-substring-without-repeating-characters