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,37 +1,38 @@
829,Consecutive Numbers Sum,37.5%,Hard,0.534071766545536, https://leetcode.com/problems/consecutive-numbers-sum
761,Special Binary String,54.7%,Hard,0.3007541540191337, https://leetcode.com/problems/special-binary-string
42,Trapping Rain Water,48.9%,Hard,0.0674365414927314, https://leetcode.com/problems/trapping-rain-water
362,Design Hit Counter,63.7%,Medium,0.05622967649867821, https://leetcode.com/problems/design-hit-counter
735,Asteroid Collision,41.0%,Medium,0.05479154882968245, https://leetcode.com/problems/asteroid-collision
1353,Maximum Number of Events That Can Be Attended,30.5%,Medium,0.05428741283782842, https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended
1010,Pairs of Songs With Total Durations Divisible by 60,47.4%,Easy,0.04180336980436055, https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
697,Degree of an Array,53.8%,Easy,0.03226086221822144, https://leetcode.com/problems/degree-of-an-array
1,Two Sum,45.6%,Easy,0.02912591612409083, https://leetcode.com/problems/two-sum
15,3Sum,26.8%,Medium,0.02661031301111795, https://leetcode.com/problems/3sum
98,Validate Binary Search Tree,27.8%,Medium,0.026187123416340663, https://leetcode.com/problems/validate-binary-search-tree
377,Combination Sum IV,45.3%,Medium,0.02087758502155521, https://leetcode.com/problems/combination-sum-iv
253,Meeting Rooms II,45.7%,Medium,0.018087309810579388, https://leetcode.com/problems/meeting-rooms-ii
54,Spiral Matrix,34.1%,Medium,0.014776167707688753, https://leetcode.com/problems/spiral-matrix
76,Minimum Window Substring,34.6%,Hard,0.013966707481708198, https://leetcode.com/problems/minimum-window-substring
273,Integer to English Words,27.1%,Hard,0.012081089250339716, https://leetcode.com/problems/integer-to-english-words
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.010575891759058162, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
380,Insert Delete GetRandom O(1),47.5%,Medium,0.009820849864094454, https://leetcode.com/problems/insert-delete-getrandom-o1
322,Coin Change,35.5%,Medium,0.00904437880665999, https://leetcode.com/problems/coin-change
238,Product of Array Except Self,60.1%,Medium,0.008821856860216758, https://leetcode.com/problems/product-of-array-except-self
4,Median of Two Sorted Arrays,29.6%,Hard,0.008754068159914991, https://leetcode.com/problems/median-of-two-sorted-arrays
49,Group Anagrams,56.9%,Medium,0.008538951314232168, https://leetcode.com/problems/group-anagrams
33,Search in Rotated Sorted Array,34.5%,Medium,0.007252832180390353, https://leetcode.com/problems/search-in-rotated-sorted-array
200,Number of Islands,46.8%,Medium,0.006490251382779317, https://leetcode.com/problems/number-of-islands
138,Copy List with Random Pointer,36.4%,Medium,0.006191011880825271, https://leetcode.com/problems/copy-list-with-random-pointer
973,K Closest Points to Origin,63.8%,Medium,0.005773688094426333, https://leetcode.com/problems/k-closest-points-to-origin
206,Reverse Linked List,62.5%,Easy,0.005257021452801617, https://leetcode.com/problems/reverse-linked-list
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0047725193990346675, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
155,Min Stack,44.5%,Easy,0.00474891074128171, https://leetcode.com/problems/min-stack
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
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
56,Merge Intervals,39.3%,Medium,0.0034728286335985107, https://leetcode.com/problems/merge-intervals
101,Symmetric Tree,46.8%,Easy,0.0034057078469827435, https://leetcode.com/problems/symmetric-tree
14,Longest Common Prefix,35.4%,Easy,0.003320331762984143, https://leetcode.com/problems/longest-common-prefix
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
21,Merge Two Sorted Lists,53.5%,Easy,0.0022551737583973706, https://leetcode.com/problems/merge-two-sorted-lists
53,Maximum Subarray,46.5%,Easy,0.002167082872150794, https://leetcode.com/problems/maximum-subarray
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
829,Consecutive Numbers Sum,37.5%,Hard,0.534071766545536, https://leetcode.com/problems/consecutive-numbers-sum
761,Special Binary String,54.7%,Hard,0.3007541540191337, https://leetcode.com/problems/special-binary-string
42,Trapping Rain Water,48.9%,Hard,0.0674365414927314, https://leetcode.com/problems/trapping-rain-water
362,Design Hit Counter,63.7%,Medium,0.05622967649867821, https://leetcode.com/problems/design-hit-counter
735,Asteroid Collision,41.0%,Medium,0.05479154882968245, https://leetcode.com/problems/asteroid-collision
1353,Maximum Number of Events That Can Be Attended,30.5%,Medium,0.05428741283782842, https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended
1010,Pairs of Songs With Total Durations Divisible by 60,47.4%,Easy,0.04180336980436055, https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
697,Degree of an Array,53.8%,Easy,0.03226086221822144, https://leetcode.com/problems/degree-of-an-array
1,Two Sum,45.6%,Easy,0.02912591612409083, https://leetcode.com/problems/two-sum
15,3Sum,26.8%,Medium,0.02661031301111795, https://leetcode.com/problems/3sum
98,Validate Binary Search Tree,27.8%,Medium,0.026187123416340663, https://leetcode.com/problems/validate-binary-search-tree
377,Combination Sum IV,45.3%,Medium,0.02087758502155521, https://leetcode.com/problems/combination-sum-iv
253,Meeting Rooms II,45.7%,Medium,0.018087309810579388, https://leetcode.com/problems/meeting-rooms-ii
54,Spiral Matrix,34.1%,Medium,0.014776167707688753, https://leetcode.com/problems/spiral-matrix
76,Minimum Window Substring,34.6%,Hard,0.013966707481708198, https://leetcode.com/problems/minimum-window-substring
273,Integer to English Words,27.1%,Hard,0.012081089250339716, https://leetcode.com/problems/integer-to-english-words
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.010575891759058162, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
380,Insert Delete GetRandom O(1),47.5%,Medium,0.009820849864094454, https://leetcode.com/problems/insert-delete-getrandom-o1
322,Coin Change,35.5%,Medium,0.00904437880665999, https://leetcode.com/problems/coin-change
238,Product of Array Except Self,60.1%,Medium,0.008821856860216758, https://leetcode.com/problems/product-of-array-except-self
4,Median of Two Sorted Arrays,29.6%,Hard,0.008754068159914991, https://leetcode.com/problems/median-of-two-sorted-arrays
49,Group Anagrams,56.9%,Medium,0.008538951314232168, https://leetcode.com/problems/group-anagrams
33,Search in Rotated Sorted Array,34.5%,Medium,0.007252832180390353, https://leetcode.com/problems/search-in-rotated-sorted-array
200,Number of Islands,46.8%,Medium,0.006490251382779317, https://leetcode.com/problems/number-of-islands
138,Copy List with Random Pointer,36.4%,Medium,0.006191011880825271, https://leetcode.com/problems/copy-list-with-random-pointer
973,K Closest Points to Origin,63.8%,Medium,0.005773688094426333, https://leetcode.com/problems/k-closest-points-to-origin
206,Reverse Linked List,62.5%,Easy,0.005257021452801617, https://leetcode.com/problems/reverse-linked-list
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0047725193990346675, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
155,Min Stack,44.5%,Easy,0.00474891074128171, https://leetcode.com/problems/min-stack
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
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
56,Merge Intervals,39.3%,Medium,0.0034728286335985107, https://leetcode.com/problems/merge-intervals
101,Symmetric Tree,46.8%,Easy,0.0034057078469827435, https://leetcode.com/problems/symmetric-tree
14,Longest Common Prefix,35.4%,Easy,0.003320331762984143, https://leetcode.com/problems/longest-common-prefix
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
21,Merge Two Sorted Lists,53.5%,Easy,0.0022551737583973706, https://leetcode.com/problems/merge-two-sorted-lists
53,Maximum Subarray,46.5%,Easy,0.002167082872150794, https://leetcode.com/problems/maximum-subarray
1 829 ID Consecutive Numbers Sum Title 37.5% Acceptance Hard Difficulty 0.534071766545536 Frequency https://leetcode.com/problems/consecutive-numbers-sum Leetcode Question Link
2 761 829 Special Binary String Consecutive Numbers Sum 54.7% 37.5% Hard Hard 0.3007541540191337 0.534071766545536 https://leetcode.com/problems/special-binary-string https://leetcode.com/problems/consecutive-numbers-sum
3 42 761 Trapping Rain Water Special Binary String 48.9% 54.7% Hard Hard 0.0674365414927314 0.3007541540191337 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/special-binary-string
4 362 42 Design Hit Counter Trapping Rain Water 63.7% 48.9% Medium Hard 0.05622967649867821 0.0674365414927314 https://leetcode.com/problems/design-hit-counter https://leetcode.com/problems/trapping-rain-water
5 735 362 Asteroid Collision Design Hit Counter 41.0% 63.7% Medium Medium 0.05479154882968245 0.05622967649867821 https://leetcode.com/problems/asteroid-collision https://leetcode.com/problems/design-hit-counter
6 1353 735 Maximum Number of Events That Can Be Attended Asteroid Collision 30.5% 41.0% Medium Medium 0.05428741283782842 0.05479154882968245 https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended https://leetcode.com/problems/asteroid-collision
7 1010 1353 Pairs of Songs With Total Durations Divisible by 60 Maximum Number of Events That Can Be Attended 47.4% 30.5% Easy Medium 0.04180336980436055 0.05428741283782842 https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60 https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended
8 697 1010 Degree of an Array Pairs of Songs With Total Durations Divisible by 60 53.8% 47.4% Easy Easy 0.03226086221822144 0.04180336980436055 https://leetcode.com/problems/degree-of-an-array https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
9 1 697 Two Sum Degree of an Array 45.6% 53.8% Easy Easy 0.02912591612409083 0.03226086221822144 https://leetcode.com/problems/two-sum https://leetcode.com/problems/degree-of-an-array
10 15 1 3Sum Two Sum 26.8% 45.6% Medium Easy 0.02661031301111795 0.02912591612409083 https://leetcode.com/problems/3sum https://leetcode.com/problems/two-sum
11 98 15 Validate Binary Search Tree 3Sum 27.8% 26.8% Medium Medium 0.026187123416340663 0.02661031301111795 https://leetcode.com/problems/validate-binary-search-tree https://leetcode.com/problems/3sum
12 377 98 Combination Sum IV Validate Binary Search Tree 45.3% 27.8% Medium Medium 0.02087758502155521 0.026187123416340663 https://leetcode.com/problems/combination-sum-iv https://leetcode.com/problems/validate-binary-search-tree
13 253 377 Meeting Rooms II Combination Sum IV 45.7% 45.3% Medium Medium 0.018087309810579388 0.02087758502155521 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/combination-sum-iv
14 54 253 Spiral Matrix Meeting Rooms II 34.1% 45.7% Medium Medium 0.014776167707688753 0.018087309810579388 https://leetcode.com/problems/spiral-matrix https://leetcode.com/problems/meeting-rooms-ii
15 76 54 Minimum Window Substring Spiral Matrix 34.6% 34.1% Hard Medium 0.013966707481708198 0.014776167707688753 https://leetcode.com/problems/minimum-window-substring https://leetcode.com/problems/spiral-matrix
16 273 76 Integer to English Words Minimum Window Substring 27.1% 34.6% Hard Hard 0.012081089250339716 0.013966707481708198 https://leetcode.com/problems/integer-to-english-words https://leetcode.com/problems/minimum-window-substring
17 236 273 Lowest Common Ancestor of a Binary Tree Integer to English Words 45.7% 27.1% Medium Hard 0.010575891759058162 0.012081089250339716 https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree https://leetcode.com/problems/integer-to-english-words
18 380 236 Insert Delete GetRandom O(1) Lowest Common Ancestor of a Binary Tree 47.5% 45.7% Medium Medium 0.009820849864094454 0.010575891759058162 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
19 322 380 Coin Change Insert Delete GetRandom O(1) 35.5% 47.5% Medium Medium 0.00904437880665999 0.009820849864094454 https://leetcode.com/problems/coin-change https://leetcode.com/problems/insert-delete-getrandom-o1
20 238 322 Product of Array Except Self Coin Change 60.1% 35.5% Medium Medium 0.008821856860216758 0.00904437880665999 https://leetcode.com/problems/product-of-array-except-self https://leetcode.com/problems/coin-change
21 4 238 Median of Two Sorted Arrays Product of Array Except Self 29.6% 60.1% Hard Medium 0.008754068159914991 0.008821856860216758 https://leetcode.com/problems/median-of-two-sorted-arrays https://leetcode.com/problems/product-of-array-except-self
22 49 4 Group Anagrams Median of Two Sorted Arrays 56.9% 29.6% Medium Hard 0.008538951314232168 0.008754068159914991 https://leetcode.com/problems/group-anagrams https://leetcode.com/problems/median-of-two-sorted-arrays
23 33 49 Search in Rotated Sorted Array Group Anagrams 34.5% 56.9% Medium Medium 0.007252832180390353 0.008538951314232168 https://leetcode.com/problems/search-in-rotated-sorted-array https://leetcode.com/problems/group-anagrams
24 200 33 Number of Islands Search in Rotated Sorted Array 46.8% 34.5% Medium Medium 0.006490251382779317 0.007252832180390353 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/search-in-rotated-sorted-array
25 138 200 Copy List with Random Pointer Number of Islands 36.4% 46.8% Medium Medium 0.006191011880825271 0.006490251382779317 https://leetcode.com/problems/copy-list-with-random-pointer https://leetcode.com/problems/number-of-islands
26 973 138 K Closest Points to Origin Copy List with Random Pointer 63.8% 36.4% Medium Medium 0.005773688094426333 0.006191011880825271 https://leetcode.com/problems/k-closest-points-to-origin https://leetcode.com/problems/copy-list-with-random-pointer
27 206 973 Reverse Linked List K Closest Points to Origin 62.5% 63.8% Easy Medium 0.005257021452801617 0.005773688094426333 https://leetcode.com/problems/reverse-linked-list https://leetcode.com/problems/k-closest-points-to-origin
28 121 206 Best Time to Buy and Sell Stock Reverse Linked List 50.5% 62.5% Easy Easy 0.0047725193990346675 0.005257021452801617 https://leetcode.com/problems/best-time-to-buy-and-sell-stock https://leetcode.com/problems/reverse-linked-list
29 155 121 Min Stack Best Time to Buy and Sell Stock 44.5% 50.5% Easy Easy 0.00474891074128171 0.0047725193990346675 https://leetcode.com/problems/min-stack https://leetcode.com/problems/best-time-to-buy-and-sell-stock
30 146 155 LRU Cache Min Stack 33.2% 44.5% Medium Easy 0.004600353139061353 0.00474891074128171 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/min-stack
31 34 146 Find First and Last Position of Element in Sorted Array LRU Cache 36.2% 33.2% Medium Medium 0.004247643638268045 0.004600353139061353 https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array https://leetcode.com/problems/lru-cache
32 56 34 Merge Intervals Find First and Last Position of Element in Sorted Array 39.3% 36.2% Medium Medium 0.0034728286335985107 0.004247643638268045 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
33 101 56 Symmetric Tree Merge Intervals 46.8% 39.3% Easy Medium 0.0034057078469827435 0.0034728286335985107 https://leetcode.com/problems/symmetric-tree https://leetcode.com/problems/merge-intervals
34 14 101 Longest Common Prefix Symmetric Tree 35.4% 46.8% Easy Easy 0.003320331762984143 0.0034057078469827435 https://leetcode.com/problems/longest-common-prefix https://leetcode.com/problems/symmetric-tree
35 20 14 Valid Parentheses Longest Common Prefix 39.0% 35.4% Easy Easy 0.0023005704055949323 0.003320331762984143 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/longest-common-prefix
36 21 20 Merge Two Sorted Lists Valid Parentheses 53.5% 39.0% Easy Easy 0.0022551737583973706 0.0023005704055949323 https://leetcode.com/problems/merge-two-sorted-lists https://leetcode.com/problems/valid-parentheses
37 53 21 Maximum Subarray Merge Two Sorted Lists 46.5% 53.5% Easy Easy 0.002167082872150794 0.0022551737583973706 https://leetcode.com/problems/maximum-subarray https://leetcode.com/problems/merge-two-sorted-lists
38 53 Maximum Subarray 46.5% Easy 0.002167082872150794 https://leetcode.com/problems/maximum-subarray