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,26 +1,27 @@
1473,Paint House III,48.1%,Hard,0.4279239789584774, https://leetcode.com/problems/paint-house-iii
1041,Robot Bounded In Circle,49.6%,Medium,0.26986631760028884, https://leetcode.com/problems/robot-bounded-in-circle
1497,Check If Array Pairs Are Divisible by k,41.1%,Medium,0.2357666456855048, https://leetcode.com/problems/check-if-array-pairs-are-divisible-by-k
1297,Maximum Number of Occurrences of a Substring,47.3%,Medium,0.07770898432731625, https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
56,Merge Intervals,39.3%,Medium,0.04173304225331761, https://leetcode.com/problems/merge-intervals
243,Shortest Word Distance,61.0%,Easy,0.040780370344928096, https://leetcode.com/problems/shortest-word-distance
324,Wiggle Sort II,29.9%,Medium,0.02898753687325229, https://leetcode.com/problems/wiggle-sort-ii
68,Text Justification,27.7%,Hard,0.0276451606661453, https://leetcode.com/problems/text-justification
12,Integer to Roman,55.1%,Medium,0.019096697456456382, https://leetcode.com/problems/integer-to-roman
146,LRU Cache,33.2%,Medium,0.01827577993873683, https://leetcode.com/problems/lru-cache
73,Set Matrix Zeroes,43.1%,Medium,0.015715357479628243, https://leetcode.com/problems/set-matrix-zeroes
977,Squares of a Sorted Array,72.1%,Easy,0.015474196582597383, https://leetcode.com/problems/squares-of-a-sorted-array
20,Valid Parentheses,39.0%,Easy,0.014292491180025941, https://leetcode.com/problems/valid-parentheses
1047,Remove All Adjacent Duplicates In String,68.6%,Easy,0.013059277989179281, https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
242,Valid Anagram,56.9%,Easy,0.009322628116274939, https://leetcode.com/problems/valid-anagram
128,Longest Consecutive Sequence,45.1%,Hard,0.009051883485315484, https://leetcode.com/problems/longest-consecutive-sequence
876,Middle of the Linked List,68.4%,Easy,0.007624893975696915, https://leetcode.com/problems/middle-of-the-linked-list
2,Add Two Numbers,33.9%,Medium,0.006737434951993369, https://leetcode.com/problems/add-two-numbers
973,K Closest Points to Origin,63.8%,Medium,0.005773688094426333, https://leetcode.com/problems/k-closest-points-to-origin
75,Sort Colors,47.3%,Medium,0.004992521603120986, https://leetcode.com/problems/sort-colors
53,Maximum Subarray,46.5%,Easy,0.004869349014182134, https://leetcode.com/problems/maximum-subarray
189,Rotate Array,34.7%,Easy,0.004029826126500844, https://leetcode.com/problems/rotate-array
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
5,Longest Palindromic Substring,29.5%,Medium,0.002279333142507479, https://leetcode.com/problems/longest-palindromic-substring
15,3Sum,26.8%,Medium,0.0021990113314367685, https://leetcode.com/problems/3sum
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1473,Paint House III,48.1%,Hard,0.4279239789584774, https://leetcode.com/problems/paint-house-iii
1041,Robot Bounded In Circle,49.6%,Medium,0.26986631760028884, https://leetcode.com/problems/robot-bounded-in-circle
1497,Check If Array Pairs Are Divisible by k,41.1%,Medium,0.2357666456855048, https://leetcode.com/problems/check-if-array-pairs-are-divisible-by-k
1297,Maximum Number of Occurrences of a Substring,47.3%,Medium,0.07770898432731625, https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
56,Merge Intervals,39.3%,Medium,0.04173304225331761, https://leetcode.com/problems/merge-intervals
243,Shortest Word Distance,61.0%,Easy,0.040780370344928096, https://leetcode.com/problems/shortest-word-distance
324,Wiggle Sort II,29.9%,Medium,0.02898753687325229, https://leetcode.com/problems/wiggle-sort-ii
68,Text Justification,27.7%,Hard,0.0276451606661453, https://leetcode.com/problems/text-justification
12,Integer to Roman,55.1%,Medium,0.019096697456456382, https://leetcode.com/problems/integer-to-roman
146,LRU Cache,33.2%,Medium,0.01827577993873683, https://leetcode.com/problems/lru-cache
73,Set Matrix Zeroes,43.1%,Medium,0.015715357479628243, https://leetcode.com/problems/set-matrix-zeroes
977,Squares of a Sorted Array,72.1%,Easy,0.015474196582597383, https://leetcode.com/problems/squares-of-a-sorted-array
20,Valid Parentheses,39.0%,Easy,0.014292491180025941, https://leetcode.com/problems/valid-parentheses
1047,Remove All Adjacent Duplicates In String,68.6%,Easy,0.013059277989179281, https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
242,Valid Anagram,56.9%,Easy,0.009322628116274939, https://leetcode.com/problems/valid-anagram
128,Longest Consecutive Sequence,45.1%,Hard,0.009051883485315484, https://leetcode.com/problems/longest-consecutive-sequence
876,Middle of the Linked List,68.4%,Easy,0.007624893975696915, https://leetcode.com/problems/middle-of-the-linked-list
2,Add Two Numbers,33.9%,Medium,0.006737434951993369, https://leetcode.com/problems/add-two-numbers
973,K Closest Points to Origin,63.8%,Medium,0.005773688094426333, https://leetcode.com/problems/k-closest-points-to-origin
75,Sort Colors,47.3%,Medium,0.004992521603120986, https://leetcode.com/problems/sort-colors
53,Maximum Subarray,46.5%,Easy,0.004869349014182134, https://leetcode.com/problems/maximum-subarray
189,Rotate Array,34.7%,Easy,0.004029826126500844, https://leetcode.com/problems/rotate-array
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
5,Longest Palindromic Substring,29.5%,Medium,0.002279333142507479, https://leetcode.com/problems/longest-palindromic-substring
15,3Sum,26.8%,Medium,0.0021990113314367685, https://leetcode.com/problems/3sum
1 1473 ID Paint House III Title 48.1% Acceptance Hard Difficulty 0.4279239789584774 Frequency https://leetcode.com/problems/paint-house-iii Leetcode Question Link
2 1041 1473 Robot Bounded In Circle Paint House III 49.6% 48.1% Medium Hard 0.26986631760028884 0.4279239789584774 https://leetcode.com/problems/robot-bounded-in-circle https://leetcode.com/problems/paint-house-iii
3 1497 1041 Check If Array Pairs Are Divisible by k Robot Bounded In Circle 41.1% 49.6% Medium Medium 0.2357666456855048 0.26986631760028884 https://leetcode.com/problems/check-if-array-pairs-are-divisible-by-k https://leetcode.com/problems/robot-bounded-in-circle
4 1297 1497 Maximum Number of Occurrences of a Substring Check If Array Pairs Are Divisible by k 47.3% 41.1% Medium Medium 0.07770898432731625 0.2357666456855048 https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring https://leetcode.com/problems/check-if-array-pairs-are-divisible-by-k
5 56 1297 Merge Intervals Maximum Number of Occurrences of a Substring 39.3% 47.3% Medium Medium 0.04173304225331761 0.07770898432731625 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
6 243 56 Shortest Word Distance Merge Intervals 61.0% 39.3% Easy Medium 0.040780370344928096 0.04173304225331761 https://leetcode.com/problems/shortest-word-distance https://leetcode.com/problems/merge-intervals
7 324 243 Wiggle Sort II Shortest Word Distance 29.9% 61.0% Medium Easy 0.02898753687325229 0.040780370344928096 https://leetcode.com/problems/wiggle-sort-ii https://leetcode.com/problems/shortest-word-distance
8 68 324 Text Justification Wiggle Sort II 27.7% 29.9% Hard Medium 0.0276451606661453 0.02898753687325229 https://leetcode.com/problems/text-justification https://leetcode.com/problems/wiggle-sort-ii
9 12 68 Integer to Roman Text Justification 55.1% 27.7% Medium Hard 0.019096697456456382 0.0276451606661453 https://leetcode.com/problems/integer-to-roman https://leetcode.com/problems/text-justification
10 146 12 LRU Cache Integer to Roman 33.2% 55.1% Medium Medium 0.01827577993873683 0.019096697456456382 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/integer-to-roman
11 73 146 Set Matrix Zeroes LRU Cache 43.1% 33.2% Medium Medium 0.015715357479628243 0.01827577993873683 https://leetcode.com/problems/set-matrix-zeroes https://leetcode.com/problems/lru-cache
12 977 73 Squares of a Sorted Array Set Matrix Zeroes 72.1% 43.1% Easy Medium 0.015474196582597383 0.015715357479628243 https://leetcode.com/problems/squares-of-a-sorted-array https://leetcode.com/problems/set-matrix-zeroes
13 20 977 Valid Parentheses Squares of a Sorted Array 39.0% 72.1% Easy Easy 0.014292491180025941 0.015474196582597383 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/squares-of-a-sorted-array
14 1047 20 Remove All Adjacent Duplicates In String Valid Parentheses 68.6% 39.0% Easy Easy 0.013059277989179281 0.014292491180025941 https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string https://leetcode.com/problems/valid-parentheses
15 227 1047 Basic Calculator II Remove All Adjacent Duplicates In String 36.9% 68.6% Medium Easy 0.01239941490503826 0.013059277989179281 https://leetcode.com/problems/basic-calculator-ii https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string
16 242 227 Valid Anagram Basic Calculator II 56.9% 36.9% Easy Medium 0.009322628116274939 0.01239941490503826 https://leetcode.com/problems/valid-anagram https://leetcode.com/problems/basic-calculator-ii
17 128 242 Longest Consecutive Sequence Valid Anagram 45.1% 56.9% Hard Easy 0.009051883485315484 0.009322628116274939 https://leetcode.com/problems/longest-consecutive-sequence https://leetcode.com/problems/valid-anagram
18 876 128 Middle of the Linked List Longest Consecutive Sequence 68.4% 45.1% Easy Hard 0.007624893975696915 0.009051883485315484 https://leetcode.com/problems/middle-of-the-linked-list https://leetcode.com/problems/longest-consecutive-sequence
19 2 876 Add Two Numbers Middle of the Linked List 33.9% 68.4% Medium Easy 0.006737434951993369 0.007624893975696915 https://leetcode.com/problems/add-two-numbers https://leetcode.com/problems/middle-of-the-linked-list
20 973 2 K Closest Points to Origin Add Two Numbers 63.8% 33.9% Medium Medium 0.005773688094426333 0.006737434951993369 https://leetcode.com/problems/k-closest-points-to-origin https://leetcode.com/problems/add-two-numbers
21 75 973 Sort Colors K Closest Points to Origin 47.3% 63.8% Medium Medium 0.004992521603120986 0.005773688094426333 https://leetcode.com/problems/sort-colors https://leetcode.com/problems/k-closest-points-to-origin
22 53 75 Maximum Subarray Sort Colors 46.5% 47.3% Easy Medium 0.004869349014182134 0.004992521603120986 https://leetcode.com/problems/maximum-subarray https://leetcode.com/problems/sort-colors
23 189 53 Rotate Array Maximum Subarray 34.7% 46.5% Easy Easy 0.004029826126500844 0.004869349014182134 https://leetcode.com/problems/rotate-array https://leetcode.com/problems/maximum-subarray
24 1 189 Two Sum Rotate Array 45.6% 34.7% Easy Easy 0.003278422738041615 0.004029826126500844 https://leetcode.com/problems/two-sum https://leetcode.com/problems/rotate-array
25 5 1 Longest Palindromic Substring Two Sum 29.5% 45.6% Medium Easy 0.002279333142507479 0.003278422738041615 https://leetcode.com/problems/longest-palindromic-substring https://leetcode.com/problems/two-sum
26 15 5 3Sum Longest Palindromic Substring 26.8% 29.5% Medium Medium 0.0021990113314367685 0.002279333142507479 https://leetcode.com/problems/3sum https://leetcode.com/problems/longest-palindromic-substring
27 15 3Sum 26.8% Medium 0.0021990113314367685 https://leetcode.com/problems/3sum