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,31 +1,32 @@
317,Shortest Distance from All Buildings,41.4%,Hard,0.14037470417111314, https://leetcode.com/problems/shortest-distance-from-all-buildings
146,LRU Cache,33.2%,Medium,0.10560037836986279, https://leetcode.com/problems/lru-cache
632,Smallest Range Covering Elements from K Lists,52.4%,Hard,0.07082605256861242, https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists
772,Basic Calculator III,41.3%,Hard,0.06331227941432688, https://leetcode.com/problems/basic-calculator-iii
212,Word Search II,34.9%,Hard,0.05999879858378973, https://leetcode.com/problems/word-search-ii
224,Basic Calculator,36.8%,Hard,0.046568165477211425, https://leetcode.com/problems/basic-calculator
1031,Maximum Sum of Two Non-Overlapping Subarrays,57.9%,Medium,0.03711000965123125, https://leetcode.com/problems/maximum-sum-of-two-non-overlapping-subarrays
1146,Snapshot Array,37.0%,Medium,0.0317991816929387, https://leetcode.com/problems/snapshot-array
68,Text Justification,27.7%,Hard,0.0276451606661453, https://leetcode.com/problems/text-justification
310,Minimum Height Trees,32.3%,Medium,0.02446605215440636, https://leetcode.com/problems/minimum-height-trees
340,Longest Substring with At Most K Distinct Characters,44.1%,Hard,0.016122880486563188, https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters
79,Word Search,35.6%,Medium,0.014883688014740005, https://leetcode.com/problems/word-search
329,Longest Increasing Path in a Matrix,43.4%,Hard,0.013400535537482126, https://leetcode.com/problems/longest-increasing-path-in-a-matrix
91,Decode Ways,24.7%,Medium,0.013379120336324091, https://leetcode.com/problems/decode-ways
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
986,Interval List Intersections,67.3%,Medium,0.011969023795320735, https://leetcode.com/problems/interval-list-intersections
200,Number of Islands,46.8%,Medium,0.011509262420590827, https://leetcode.com/problems/number-of-islands
733,Flood Fill,55.3%,Easy,0.011217167530924988, https://leetcode.com/problems/flood-fill
234,Palindrome Linked List,39.3%,Easy,0.010171877938733932, https://leetcode.com/problems/palindrome-linked-list
42,Trapping Rain Water,48.9%,Hard,0.009762524655659178, https://leetcode.com/problems/trapping-rain-water
139,Word Break,40.1%,Medium,0.008741314401573542, https://leetcode.com/problems/word-break
394,Decode String,50.0%,Medium,0.008166644000272283, https://leetcode.com/problems/decode-string
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
56,Merge Intervals,39.3%,Medium,0.007796972706004796, https://leetcode.com/problems/merge-intervals
415,Add Strings,47.5%,Easy,0.007587289812159497, https://leetcode.com/problems/add-strings
14,Longest Common Prefix,35.4%,Easy,0.00745530292090591, https://leetcode.com/problems/longest-common-prefix
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.007077170374085099, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
54,Spiral Matrix,34.1%,Medium,0.0065941551175130245, https://leetcode.com/problems/spiral-matrix
189,Rotate Array,34.7%,Easy,0.004029826126500844, https://leetcode.com/problems/rotate-array
347,Top K Frequent Elements,61.2%,Medium,0.0033396446491217604, https://leetcode.com/problems/top-k-frequent-elements
210,Course Schedule II,40.7%,Medium,0.0019086707135282834, https://leetcode.com/problems/course-schedule-ii
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
317,Shortest Distance from All Buildings,41.4%,Hard,0.14037470417111314, https://leetcode.com/problems/shortest-distance-from-all-buildings
146,LRU Cache,33.2%,Medium,0.10560037836986279, https://leetcode.com/problems/lru-cache
632,Smallest Range Covering Elements from K Lists,52.4%,Hard,0.07082605256861242, https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists
772,Basic Calculator III,41.3%,Hard,0.06331227941432688, https://leetcode.com/problems/basic-calculator-iii
212,Word Search II,34.9%,Hard,0.05999879858378973, https://leetcode.com/problems/word-search-ii
224,Basic Calculator,36.8%,Hard,0.046568165477211425, https://leetcode.com/problems/basic-calculator
1031,Maximum Sum of Two Non-Overlapping Subarrays,57.9%,Medium,0.03711000965123125, https://leetcode.com/problems/maximum-sum-of-two-non-overlapping-subarrays
1146,Snapshot Array,37.0%,Medium,0.0317991816929387, https://leetcode.com/problems/snapshot-array
68,Text Justification,27.7%,Hard,0.0276451606661453, https://leetcode.com/problems/text-justification
310,Minimum Height Trees,32.3%,Medium,0.02446605215440636, https://leetcode.com/problems/minimum-height-trees
340,Longest Substring with At Most K Distinct Characters,44.1%,Hard,0.016122880486563188, https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters
79,Word Search,35.6%,Medium,0.014883688014740005, https://leetcode.com/problems/word-search
329,Longest Increasing Path in a Matrix,43.4%,Hard,0.013400535537482126, https://leetcode.com/problems/longest-increasing-path-in-a-matrix
91,Decode Ways,24.7%,Medium,0.013379120336324091, https://leetcode.com/problems/decode-ways
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
986,Interval List Intersections,67.3%,Medium,0.011969023795320735, https://leetcode.com/problems/interval-list-intersections
200,Number of Islands,46.8%,Medium,0.011509262420590827, https://leetcode.com/problems/number-of-islands
733,Flood Fill,55.3%,Easy,0.011217167530924988, https://leetcode.com/problems/flood-fill
234,Palindrome Linked List,39.3%,Easy,0.010171877938733932, https://leetcode.com/problems/palindrome-linked-list
42,Trapping Rain Water,48.9%,Hard,0.009762524655659178, https://leetcode.com/problems/trapping-rain-water
139,Word Break,40.1%,Medium,0.008741314401573542, https://leetcode.com/problems/word-break
394,Decode String,50.0%,Medium,0.008166644000272283, https://leetcode.com/problems/decode-string
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
56,Merge Intervals,39.3%,Medium,0.007796972706004796, https://leetcode.com/problems/merge-intervals
415,Add Strings,47.5%,Easy,0.007587289812159497, https://leetcode.com/problems/add-strings
14,Longest Common Prefix,35.4%,Easy,0.00745530292090591, https://leetcode.com/problems/longest-common-prefix
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.007077170374085099, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
54,Spiral Matrix,34.1%,Medium,0.0065941551175130245, https://leetcode.com/problems/spiral-matrix
189,Rotate Array,34.7%,Easy,0.004029826126500844, https://leetcode.com/problems/rotate-array
347,Top K Frequent Elements,61.2%,Medium,0.0033396446491217604, https://leetcode.com/problems/top-k-frequent-elements
210,Course Schedule II,40.7%,Medium,0.0019086707135282834, https://leetcode.com/problems/course-schedule-ii
1 317 ID Shortest Distance from All Buildings Title 41.4% Acceptance Hard Difficulty 0.14037470417111314 Frequency https://leetcode.com/problems/shortest-distance-from-all-buildings Leetcode Question Link
2 146 317 LRU Cache Shortest Distance from All Buildings 33.2% 41.4% Medium Hard 0.10560037836986279 0.14037470417111314 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/shortest-distance-from-all-buildings
3 632 146 Smallest Range Covering Elements from K Lists LRU Cache 52.4% 33.2% Hard Medium 0.07082605256861242 0.10560037836986279 https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists https://leetcode.com/problems/lru-cache
4 772 632 Basic Calculator III Smallest Range Covering Elements from K Lists 41.3% 52.4% Hard Hard 0.06331227941432688 0.07082605256861242 https://leetcode.com/problems/basic-calculator-iii https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists
5 212 772 Word Search II Basic Calculator III 34.9% 41.3% Hard Hard 0.05999879858378973 0.06331227941432688 https://leetcode.com/problems/word-search-ii https://leetcode.com/problems/basic-calculator-iii
6 224 212 Basic Calculator Word Search II 36.8% 34.9% Hard Hard 0.046568165477211425 0.05999879858378973 https://leetcode.com/problems/basic-calculator https://leetcode.com/problems/word-search-ii
7 1031 224 Maximum Sum of Two Non-Overlapping Subarrays Basic Calculator 57.9% 36.8% Medium Hard 0.03711000965123125 0.046568165477211425 https://leetcode.com/problems/maximum-sum-of-two-non-overlapping-subarrays https://leetcode.com/problems/basic-calculator
8 1146 1031 Snapshot Array Maximum Sum of Two Non-Overlapping Subarrays 37.0% 57.9% Medium Medium 0.0317991816929387 0.03711000965123125 https://leetcode.com/problems/snapshot-array https://leetcode.com/problems/maximum-sum-of-two-non-overlapping-subarrays
9 68 1146 Text Justification Snapshot Array 27.7% 37.0% Hard Medium 0.0276451606661453 0.0317991816929387 https://leetcode.com/problems/text-justification https://leetcode.com/problems/snapshot-array
10 310 68 Minimum Height Trees Text Justification 32.3% 27.7% Medium Hard 0.02446605215440636 0.0276451606661453 https://leetcode.com/problems/minimum-height-trees https://leetcode.com/problems/text-justification
11 340 310 Longest Substring with At Most K Distinct Characters Minimum Height Trees 44.1% 32.3% Hard Medium 0.016122880486563188 0.02446605215440636 https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters https://leetcode.com/problems/minimum-height-trees
12 79 340 Word Search Longest Substring with At Most K Distinct Characters 35.6% 44.1% Medium Hard 0.014883688014740005 0.016122880486563188 https://leetcode.com/problems/word-search https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters
13 329 79 Longest Increasing Path in a Matrix Word Search 43.4% 35.6% Hard Medium 0.013400535537482126 0.014883688014740005 https://leetcode.com/problems/longest-increasing-path-in-a-matrix https://leetcode.com/problems/word-search
14 91 329 Decode Ways Longest Increasing Path in a Matrix 24.7% 43.4% Medium Hard 0.013379120336324091 0.013400535537482126 https://leetcode.com/problems/decode-ways https://leetcode.com/problems/longest-increasing-path-in-a-matrix
15 227 91 Basic Calculator II Decode Ways 36.9% 24.7% Medium Medium 0.01239941490503826 0.013379120336324091 https://leetcode.com/problems/basic-calculator-ii https://leetcode.com/problems/decode-ways
16 986 227 Interval List Intersections Basic Calculator II 67.3% 36.9% Medium Medium 0.011969023795320735 0.01239941490503826 https://leetcode.com/problems/interval-list-intersections https://leetcode.com/problems/basic-calculator-ii
17 200 986 Number of Islands Interval List Intersections 46.8% 67.3% Medium Medium 0.011509262420590827 0.011969023795320735 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/interval-list-intersections
18 733 200 Flood Fill Number of Islands 55.3% 46.8% Easy Medium 0.011217167530924988 0.011509262420590827 https://leetcode.com/problems/flood-fill https://leetcode.com/problems/number-of-islands
19 234 733 Palindrome Linked List Flood Fill 39.3% 55.3% Easy Easy 0.010171877938733932 0.011217167530924988 https://leetcode.com/problems/palindrome-linked-list https://leetcode.com/problems/flood-fill
20 42 234 Trapping Rain Water Palindrome Linked List 48.9% 39.3% Hard Easy 0.009762524655659178 0.010171877938733932 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/palindrome-linked-list
21 139 42 Word Break Trapping Rain Water 40.1% 48.9% Medium Hard 0.008741314401573542 0.009762524655659178 https://leetcode.com/problems/word-break https://leetcode.com/problems/trapping-rain-water
22 394 139 Decode String Word Break 50.0% 40.1% Medium Medium 0.008166644000272283 0.008741314401573542 https://leetcode.com/problems/decode-string https://leetcode.com/problems/word-break
23 253 394 Meeting Rooms II Decode String 45.7% 50.0% Medium Medium 0.008079219870546493 0.008166644000272283 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/decode-string
24 56 253 Merge Intervals Meeting Rooms II 39.3% 45.7% Medium Medium 0.007796972706004796 0.008079219870546493 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/meeting-rooms-ii
25 415 56 Add Strings Merge Intervals 47.5% 39.3% Easy Medium 0.007587289812159497 0.007796972706004796 https://leetcode.com/problems/add-strings https://leetcode.com/problems/merge-intervals
26 14 415 Longest Common Prefix Add Strings 35.4% 47.5% Easy Easy 0.00745530292090591 0.007587289812159497 https://leetcode.com/problems/longest-common-prefix https://leetcode.com/problems/add-strings
27 297 14 Serialize and Deserialize Binary Tree Longest Common Prefix 47.5% 35.4% Hard Easy 0.007077170374085099 0.00745530292090591 https://leetcode.com/problems/serialize-and-deserialize-binary-tree https://leetcode.com/problems/longest-common-prefix
28 54 297 Spiral Matrix Serialize and Deserialize Binary Tree 34.1% 47.5% Medium Hard 0.0065941551175130245 0.007077170374085099 https://leetcode.com/problems/spiral-matrix https://leetcode.com/problems/serialize-and-deserialize-binary-tree
29 189 54 Rotate Array Spiral Matrix 34.7% 34.1% Easy Medium 0.004029826126500844 0.0065941551175130245 https://leetcode.com/problems/rotate-array https://leetcode.com/problems/spiral-matrix
30 347 189 Top K Frequent Elements Rotate Array 61.2% 34.7% Medium Easy 0.0033396446491217604 0.004029826126500844 https://leetcode.com/problems/top-k-frequent-elements https://leetcode.com/problems/rotate-array
31 210 347 Course Schedule II Top K Frequent Elements 40.7% 61.2% Medium Medium 0.0019086707135282834 0.0033396446491217604 https://leetcode.com/problems/course-schedule-ii https://leetcode.com/problems/top-k-frequent-elements
32 210 Course Schedule II 40.7% Medium 0.0019086707135282834 https://leetcode.com/problems/course-schedule-ii