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,38 +1,39 @@
755,Pour Water,43.3%,Medium,4.694392422785564, https://leetcode.com/problems/pour-water
336,Palindrome Pairs,33.7%,Hard,4.005323090387116, https://leetcode.com/problems/palindrome-pairs
751,IP to CIDR,61.7%,Medium,3.3596034843633182, https://leetcode.com/problems/ip-to-cidr
251,Flatten 2D Vector,45.7%,Medium,2.6705341519648713, https://leetcode.com/problems/flatten-2d-vector
773,Sliding Puzzle,59.3%,Hard,2.143603485897122, https://leetcode.com/problems/sliding-puzzle
269,Alien Dictionary,33.3%,Hard,2.125834154172795, https://leetcode.com/problems/alien-dictionary
1166,Design File System,56.8%,Medium,2.054985245702309, https://leetcode.com/problems/design-file-system
787,Cheapest Flights Within K Stops,39.3%,Medium,1.820249200959109, https://leetcode.com/problems/cheapest-flights-within-k-stops
166,Fraction to Recurring Decimal,21.6%,Medium,1.1768918457232653, https://leetcode.com/problems/fraction-to-recurring-decimal
39,Combination Sum,56.1%,Medium,0.8659171996195525, https://leetcode.com/problems/combination-sum
875,Koko Eating Bananas,52.1%,Medium,0.8409986269592165, https://leetcode.com/problems/koko-eating-bananas
759,Employee Free Time,66.2%,Hard,0.6974963641784472, https://leetcode.com/problems/employee-free-time
864,Shortest Path to Get All Keys,40.1%,Hard,0.6061358035703156, https://leetcode.com/problems/shortest-path-to-get-all-keys
324,Wiggle Sort II,29.9%,Medium,0.5511769192895581, https://leetcode.com/problems/wiggle-sort-ii
756,Pyramid Transition Matrix,54.6%,Medium,0.38776553100876343, https://leetcode.com/problems/pyramid-transition-matrix
341,Flatten Nested List Iterator,52.9%,Medium,0.3426517489923298, https://leetcode.com/problems/flatten-nested-list-iterator
68,Text Justification,27.7%,Hard,0.29518712556880805, https://leetcode.com/problems/text-justification
1257,Smallest Common Region,58.8%,Medium,0.2561688067457042, https://leetcode.com/problems/smallest-common-region
1235,Maximum Profit in Job Scheduling,44.0%,Hard,0.1532629744871177, https://leetcode.com/problems/maximum-profit-in-job-scheduling
322,Coin Change,35.5%,Medium,0.06260600694223208, https://leetcode.com/problems/coin-change
588,Design In-Memory File System,45.9%,Hard,0.05841076215641451, https://leetcode.com/problems/design-in-memory-file-system
843,Guess the Word,46.1%,Hard,0.045462374076757336, https://leetcode.com/problems/guess-the-word
280,Wiggle Sort,63.8%,Medium,0.04362742017962607, https://leetcode.com/problems/wiggle-sort
42,Trapping Rain Water,48.9%,Hard,0.02688623073425064, https://leetcode.com/problems/trapping-rain-water
622,Design Circular Queue,43.7%,Medium,0.02246023667974994, https://leetcode.com/problems/design-circular-queue
212,Word Search II,34.9%,Hard,0.02201654487096149, https://leetcode.com/problems/word-search-ii
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.018724947332324816, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
1,Two Sum,45.6%,Easy,0.016487580637467636, https://leetcode.com/problems/two-sum
299,Bulls and Cows,42.4%,Easy,0.016227536621756702, https://leetcode.com/problems/bulls-and-cows
211,Add and Search Word - Data structure design,38.1%,Medium,0.010438508143923443, https://leetcode.com/problems/add-and-search-word-data-structure-design
5,Longest Palindromic Substring,29.5%,Medium,0.009086325220960808, https://leetcode.com/problems/longest-palindromic-substring
953,Verifying an Alien Dictionary,54.1%,Easy,0.007884921592696038, https://leetcode.com/problems/verifying-an-alien-dictionary
76,Minimum Window Substring,34.6%,Hard,0.006231520398723243, https://leetcode.com/problems/minimum-window-substring
34,Find First and Last Position of Element in Sorted Array,36.2%,Medium,0.004247643638268045, https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
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
21,Merge Two Sorted Lists,53.5%,Easy,0.0022551737583973706, https://leetcode.com/problems/merge-two-sorted-lists
2,Add Two Numbers,33.9%,Medium,0.0016886191111440908, https://leetcode.com/problems/add-two-numbers
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
755,Pour Water,43.3%,Medium,4.694392422785564, https://leetcode.com/problems/pour-water
336,Palindrome Pairs,33.7%,Hard,4.005323090387116, https://leetcode.com/problems/palindrome-pairs
751,IP to CIDR,61.7%,Medium,3.3596034843633182, https://leetcode.com/problems/ip-to-cidr
251,Flatten 2D Vector,45.7%,Medium,2.6705341519648713, https://leetcode.com/problems/flatten-2d-vector
773,Sliding Puzzle,59.3%,Hard,2.143603485897122, https://leetcode.com/problems/sliding-puzzle
269,Alien Dictionary,33.3%,Hard,2.125834154172795, https://leetcode.com/problems/alien-dictionary
1166,Design File System,56.8%,Medium,2.054985245702309, https://leetcode.com/problems/design-file-system
787,Cheapest Flights Within K Stops,39.3%,Medium,1.820249200959109, https://leetcode.com/problems/cheapest-flights-within-k-stops
166,Fraction to Recurring Decimal,21.6%,Medium,1.1768918457232653, https://leetcode.com/problems/fraction-to-recurring-decimal
39,Combination Sum,56.1%,Medium,0.8659171996195525, https://leetcode.com/problems/combination-sum
875,Koko Eating Bananas,52.1%,Medium,0.8409986269592165, https://leetcode.com/problems/koko-eating-bananas
759,Employee Free Time,66.2%,Hard,0.6974963641784472, https://leetcode.com/problems/employee-free-time
864,Shortest Path to Get All Keys,40.1%,Hard,0.6061358035703156, https://leetcode.com/problems/shortest-path-to-get-all-keys
324,Wiggle Sort II,29.9%,Medium,0.5511769192895581, https://leetcode.com/problems/wiggle-sort-ii
756,Pyramid Transition Matrix,54.6%,Medium,0.38776553100876343, https://leetcode.com/problems/pyramid-transition-matrix
341,Flatten Nested List Iterator,52.9%,Medium,0.3426517489923298, https://leetcode.com/problems/flatten-nested-list-iterator
68,Text Justification,27.7%,Hard,0.29518712556880805, https://leetcode.com/problems/text-justification
1257,Smallest Common Region,58.8%,Medium,0.2561688067457042, https://leetcode.com/problems/smallest-common-region
1235,Maximum Profit in Job Scheduling,44.0%,Hard,0.1532629744871177, https://leetcode.com/problems/maximum-profit-in-job-scheduling
322,Coin Change,35.5%,Medium,0.06260600694223208, https://leetcode.com/problems/coin-change
588,Design In-Memory File System,45.9%,Hard,0.05841076215641451, https://leetcode.com/problems/design-in-memory-file-system
843,Guess the Word,46.1%,Hard,0.045462374076757336, https://leetcode.com/problems/guess-the-word
280,Wiggle Sort,63.8%,Medium,0.04362742017962607, https://leetcode.com/problems/wiggle-sort
42,Trapping Rain Water,48.9%,Hard,0.02688623073425064, https://leetcode.com/problems/trapping-rain-water
622,Design Circular Queue,43.7%,Medium,0.02246023667974994, https://leetcode.com/problems/design-circular-queue
212,Word Search II,34.9%,Hard,0.02201654487096149, https://leetcode.com/problems/word-search-ii
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.018724947332324816, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
1,Two Sum,45.6%,Easy,0.016487580637467636, https://leetcode.com/problems/two-sum
299,Bulls and Cows,42.4%,Easy,0.016227536621756702, https://leetcode.com/problems/bulls-and-cows
211,Add and Search Word - Data structure design,38.1%,Medium,0.010438508143923443, https://leetcode.com/problems/add-and-search-word-data-structure-design
5,Longest Palindromic Substring,29.5%,Medium,0.009086325220960808, https://leetcode.com/problems/longest-palindromic-substring
953,Verifying an Alien Dictionary,54.1%,Easy,0.007884921592696038, https://leetcode.com/problems/verifying-an-alien-dictionary
76,Minimum Window Substring,34.6%,Hard,0.006231520398723243, https://leetcode.com/problems/minimum-window-substring
34,Find First and Last Position of Element in Sorted Array,36.2%,Medium,0.004247643638268045, https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
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
21,Merge Two Sorted Lists,53.5%,Easy,0.0022551737583973706, https://leetcode.com/problems/merge-two-sorted-lists
2,Add Two Numbers,33.9%,Medium,0.0016886191111440908, https://leetcode.com/problems/add-two-numbers
1 755 ID Pour Water Title 43.3% Acceptance Medium Difficulty 4.694392422785564 Frequency https://leetcode.com/problems/pour-water Leetcode Question Link
2 336 755 Palindrome Pairs Pour Water 33.7% 43.3% Hard Medium 4.005323090387116 4.694392422785564 https://leetcode.com/problems/palindrome-pairs https://leetcode.com/problems/pour-water
3 751 336 IP to CIDR Palindrome Pairs 61.7% 33.7% Medium Hard 3.3596034843633182 4.005323090387116 https://leetcode.com/problems/ip-to-cidr https://leetcode.com/problems/palindrome-pairs
4 251 751 Flatten 2D Vector IP to CIDR 45.7% 61.7% Medium Medium 2.6705341519648713 3.3596034843633182 https://leetcode.com/problems/flatten-2d-vector https://leetcode.com/problems/ip-to-cidr
5 773 251 Sliding Puzzle Flatten 2D Vector 59.3% 45.7% Hard Medium 2.143603485897122 2.6705341519648713 https://leetcode.com/problems/sliding-puzzle https://leetcode.com/problems/flatten-2d-vector
6 269 773 Alien Dictionary Sliding Puzzle 33.3% 59.3% Hard Hard 2.125834154172795 2.143603485897122 https://leetcode.com/problems/alien-dictionary https://leetcode.com/problems/sliding-puzzle
7 1166 269 Design File System Alien Dictionary 56.8% 33.3% Medium Hard 2.054985245702309 2.125834154172795 https://leetcode.com/problems/design-file-system https://leetcode.com/problems/alien-dictionary
8 787 1166 Cheapest Flights Within K Stops Design File System 39.3% 56.8% Medium Medium 1.820249200959109 2.054985245702309 https://leetcode.com/problems/cheapest-flights-within-k-stops https://leetcode.com/problems/design-file-system
9 166 787 Fraction to Recurring Decimal Cheapest Flights Within K Stops 21.6% 39.3% Medium Medium 1.1768918457232653 1.820249200959109 https://leetcode.com/problems/fraction-to-recurring-decimal https://leetcode.com/problems/cheapest-flights-within-k-stops
10 39 166 Combination Sum Fraction to Recurring Decimal 56.1% 21.6% Medium Medium 0.8659171996195525 1.1768918457232653 https://leetcode.com/problems/combination-sum https://leetcode.com/problems/fraction-to-recurring-decimal
11 875 39 Koko Eating Bananas Combination Sum 52.1% 56.1% Medium Medium 0.8409986269592165 0.8659171996195525 https://leetcode.com/problems/koko-eating-bananas https://leetcode.com/problems/combination-sum
12 759 875 Employee Free Time Koko Eating Bananas 66.2% 52.1% Hard Medium 0.6974963641784472 0.8409986269592165 https://leetcode.com/problems/employee-free-time https://leetcode.com/problems/koko-eating-bananas
13 864 759 Shortest Path to Get All Keys Employee Free Time 40.1% 66.2% Hard Hard 0.6061358035703156 0.6974963641784472 https://leetcode.com/problems/shortest-path-to-get-all-keys https://leetcode.com/problems/employee-free-time
14 324 864 Wiggle Sort II Shortest Path to Get All Keys 29.9% 40.1% Medium Hard 0.5511769192895581 0.6061358035703156 https://leetcode.com/problems/wiggle-sort-ii https://leetcode.com/problems/shortest-path-to-get-all-keys
15 756 324 Pyramid Transition Matrix Wiggle Sort II 54.6% 29.9% Medium Medium 0.38776553100876343 0.5511769192895581 https://leetcode.com/problems/pyramid-transition-matrix https://leetcode.com/problems/wiggle-sort-ii
16 341 756 Flatten Nested List Iterator Pyramid Transition Matrix 52.9% 54.6% Medium Medium 0.3426517489923298 0.38776553100876343 https://leetcode.com/problems/flatten-nested-list-iterator https://leetcode.com/problems/pyramid-transition-matrix
17 68 341 Text Justification Flatten Nested List Iterator 27.7% 52.9% Hard Medium 0.29518712556880805 0.3426517489923298 https://leetcode.com/problems/text-justification https://leetcode.com/problems/flatten-nested-list-iterator
18 1257 68 Smallest Common Region Text Justification 58.8% 27.7% Medium Hard 0.2561688067457042 0.29518712556880805 https://leetcode.com/problems/smallest-common-region https://leetcode.com/problems/text-justification
19 1235 1257 Maximum Profit in Job Scheduling Smallest Common Region 44.0% 58.8% Hard Medium 0.1532629744871177 0.2561688067457042 https://leetcode.com/problems/maximum-profit-in-job-scheduling https://leetcode.com/problems/smallest-common-region
20 322 1235 Coin Change Maximum Profit in Job Scheduling 35.5% 44.0% Medium Hard 0.06260600694223208 0.1532629744871177 https://leetcode.com/problems/coin-change https://leetcode.com/problems/maximum-profit-in-job-scheduling
21 588 322 Design In-Memory File System Coin Change 45.9% 35.5% Hard Medium 0.05841076215641451 0.06260600694223208 https://leetcode.com/problems/design-in-memory-file-system https://leetcode.com/problems/coin-change
22 843 588 Guess the Word Design In-Memory File System 46.1% 45.9% Hard Hard 0.045462374076757336 0.05841076215641451 https://leetcode.com/problems/guess-the-word https://leetcode.com/problems/design-in-memory-file-system
23 280 843 Wiggle Sort Guess the Word 63.8% 46.1% Medium Hard 0.04362742017962607 0.045462374076757336 https://leetcode.com/problems/wiggle-sort https://leetcode.com/problems/guess-the-word
24 42 280 Trapping Rain Water Wiggle Sort 48.9% 63.8% Hard Medium 0.02688623073425064 0.04362742017962607 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/wiggle-sort
25 622 42 Design Circular Queue Trapping Rain Water 43.7% 48.9% Medium Hard 0.02246023667974994 0.02688623073425064 https://leetcode.com/problems/design-circular-queue https://leetcode.com/problems/trapping-rain-water
26 212 622 Word Search II Design Circular Queue 34.9% 43.7% Hard Medium 0.02201654487096149 0.02246023667974994 https://leetcode.com/problems/word-search-ii https://leetcode.com/problems/design-circular-queue
27 236 212 Lowest Common Ancestor of a Binary Tree Word Search II 45.7% 34.9% Medium Hard 0.018724947332324816 0.02201654487096149 https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree https://leetcode.com/problems/word-search-ii
28 1 236 Two Sum Lowest Common Ancestor of a Binary Tree 45.6% 45.7% Easy Medium 0.016487580637467636 0.018724947332324816 https://leetcode.com/problems/two-sum https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
29 299 1 Bulls and Cows Two Sum 42.4% 45.6% Easy Easy 0.016227536621756702 0.016487580637467636 https://leetcode.com/problems/bulls-and-cows https://leetcode.com/problems/two-sum
30 211 299 Add and Search Word - Data structure design Bulls and Cows 38.1% 42.4% Medium Easy 0.010438508143923443 0.016227536621756702 https://leetcode.com/problems/add-and-search-word-data-structure-design https://leetcode.com/problems/bulls-and-cows
31 5 211 Longest Palindromic Substring Add and Search Word - Data structure design 29.5% 38.1% Medium Medium 0.009086325220960808 0.010438508143923443 https://leetcode.com/problems/longest-palindromic-substring https://leetcode.com/problems/add-and-search-word-data-structure-design
32 953 5 Verifying an Alien Dictionary Longest Palindromic Substring 54.1% 29.5% Easy Medium 0.007884921592696038 0.009086325220960808 https://leetcode.com/problems/verifying-an-alien-dictionary https://leetcode.com/problems/longest-palindromic-substring
33 76 953 Minimum Window Substring Verifying an Alien Dictionary 34.6% 54.1% Hard Easy 0.006231520398723243 0.007884921592696038 https://leetcode.com/problems/minimum-window-substring https://leetcode.com/problems/verifying-an-alien-dictionary
34 34 76 Find First and Last Position of Element in Sorted Array Minimum Window Substring 36.2% 34.6% Medium Hard 0.004247643638268045 0.006231520398723243 https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array https://leetcode.com/problems/minimum-window-substring
35 215 34 Kth Largest Element in an Array Find First and Last Position of Element in Sorted Array 55.4% 36.2% Medium Medium 0.003902443976931749 0.004247643638268045 https://leetcode.com/problems/kth-largest-element-in-an-array https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
36 4 215 Median of Two Sorted Arrays Kth Largest Element in an Array 29.6% 55.4% Hard Medium 0.003900160950094767 0.003902443976931749 https://leetcode.com/problems/median-of-two-sorted-arrays https://leetcode.com/problems/kth-largest-element-in-an-array
37 21 4 Merge Two Sorted Lists Median of Two Sorted Arrays 53.5% 29.6% Easy Hard 0.0022551737583973706 0.003900160950094767 https://leetcode.com/problems/merge-two-sorted-lists https://leetcode.com/problems/median-of-two-sorted-arrays
38 2 21 Add Two Numbers Merge Two Sorted Lists 33.9% 53.5% Medium Easy 0.0016886191111440908 0.0022551737583973706 https://leetcode.com/problems/add-two-numbers https://leetcode.com/problems/merge-two-sorted-lists
39 2 Add Two Numbers 33.9% Medium 0.0016886191111440908 https://leetcode.com/problems/add-two-numbers