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 @@
366,Find Leaves of Binary Tree,70.6%,Medium,0.22834203521080285, https://leetcode.com/problems/find-leaves-of-binary-tree
860,Lemonade Change,51.6%,Easy,0.18866903222469833, https://leetcode.com/problems/lemonade-change
362,Design Hit Counter,63.7%,Medium,0.1489960292385938, https://leetcode.com/problems/design-hit-counter
981,Time Based Key-Value Store,53.1%,Medium,0.1316303182973487, https://leetcode.com/problems/time-based-key-value-store
1120,Maximum Average Subtree,61.9%,Medium,0.12879510820557039, https://leetcode.com/problems/maximum-average-subtree
1071,Greatest Common Divisor of Strings,52.9%,Easy,0.12182344519338843, https://leetcode.com/problems/greatest-common-divisor-of-strings
17,Letter Combinations of a Phone Number,46.8%,Medium,0.1046212990833672, https://leetcode.com/problems/letter-combinations-of-a-phone-number
1223,Dice Roll Simulation,45.6%,Medium,0.10212949507637983, https://leetcode.com/problems/dice-roll-simulation
1366,Rank Teams by Votes,53.8%,Medium,0.07223355735937158, https://leetcode.com/problems/rank-teams-by-votes
706,Design HashMap,61.3%,Easy,0.0683442674369718, https://leetcode.com/problems/design-hashmap
300,Longest Increasing Subsequence,42.6%,Medium,0.06265630749555627, https://leetcode.com/problems/longest-increasing-subsequence
359,Logger Rate Limiter,70.8%,Easy,0.0467617659080393, https://leetcode.com/problems/logger-rate-limiter
150,Evaluate Reverse Polish Notation,36.3%,Medium,0.031526253646773944, https://leetcode.com/problems/evaluate-reverse-polish-notation
284,Peeking Iterator,45.7%,Medium,0.03110670713225487, https://leetcode.com/problems/peeking-iterator
547,Friend Circles,58.6%,Medium,0.027307522052851193, https://leetcode.com/problems/friend-circles
98,Validate Binary Search Tree,27.8%,Medium,0.026187123416340663, https://leetcode.com/problems/validate-binary-search-tree
31,Next Permutation,32.6%,Medium,0.023747034562878154, https://leetcode.com/problems/next-permutation
540,Single Element in a Sorted Array,57.9%,Medium,0.0192128868599912, https://leetcode.com/problems/single-element-in-a-sorted-array
872,Leaf-Similar Trees,64.5%,Easy,0.01752125418714782, https://leetcode.com/problems/leaf-similar-trees
23,Merge k Sorted Lists,40.2%,Hard,0.016108271385328228, https://leetcode.com/problems/merge-k-sorted-lists
701,Insert into a Binary Search Tree,77.7%,Medium,0.015522236371561826, https://leetcode.com/problems/insert-into-a-binary-search-tree
528,Random Pick with Weight,43.9%,Medium,0.014831565905995232, https://leetcode.com/problems/random-pick-with-weight
20,Valid Parentheses,39.0%,Easy,0.014292491180025941, https://leetcode.com/problems/valid-parentheses
123,Best Time to Buy and Sell Stock III,37.5%,Hard,0.011261380272539033, https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii
647,Palindromic Substrings,60.6%,Medium,0.010400509768078022, https://leetcode.com/problems/palindromic-substrings
46,Permutations,63.5%,Medium,0.009461803137288448, https://leetcode.com/problems/permutations
173,Binary Search Tree Iterator,56.6%,Medium,0.008489015324911316, https://leetcode.com/problems/binary-search-tree-iterator
394,Decode String,50.0%,Medium,0.008166644000272283, https://leetcode.com/problems/decode-string
200,Number of Islands,46.8%,Medium,0.006490251382779317, https://leetcode.com/problems/number-of-islands
543,Diameter of Binary Tree,48.4%,Easy,0.005305755914149804, https://leetcode.com/problems/diameter-of-binary-tree
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.004714210262726446, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
22,Generate Parentheses,62.7%,Medium,0.0043611059090124735, https://leetcode.com/problems/generate-parentheses
78,Subsets,62.0%,Medium,0.00368765975195334, https://leetcode.com/problems/subsets
102,Binary Tree Level Order Traversal,54.6%,Medium,0.003639014205004082, https://leetcode.com/problems/binary-tree-level-order-traversal
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.003496778759264278, https://leetcode.com/problems/longest-substring-without-repeating-characters
101,Symmetric Tree,46.8%,Easy,0.0034057078469827435, https://leetcode.com/problems/symmetric-tree
53,Maximum Subarray,46.5%,Easy,0.002167082872150794, https://leetcode.com/problems/maximum-subarray
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0021239321954525975, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
366,Find Leaves of Binary Tree,70.6%,Medium,0.22834203521080285, https://leetcode.com/problems/find-leaves-of-binary-tree
860,Lemonade Change,51.6%,Easy,0.18866903222469833, https://leetcode.com/problems/lemonade-change
362,Design Hit Counter,63.7%,Medium,0.1489960292385938, https://leetcode.com/problems/design-hit-counter
981,Time Based Key-Value Store,53.1%,Medium,0.1316303182973487, https://leetcode.com/problems/time-based-key-value-store
1120,Maximum Average Subtree,61.9%,Medium,0.12879510820557039, https://leetcode.com/problems/maximum-average-subtree
1071,Greatest Common Divisor of Strings,52.9%,Easy,0.12182344519338843, https://leetcode.com/problems/greatest-common-divisor-of-strings
17,Letter Combinations of a Phone Number,46.8%,Medium,0.1046212990833672, https://leetcode.com/problems/letter-combinations-of-a-phone-number
1223,Dice Roll Simulation,45.6%,Medium,0.10212949507637983, https://leetcode.com/problems/dice-roll-simulation
1366,Rank Teams by Votes,53.8%,Medium,0.07223355735937158, https://leetcode.com/problems/rank-teams-by-votes
706,Design HashMap,61.3%,Easy,0.0683442674369718, https://leetcode.com/problems/design-hashmap
300,Longest Increasing Subsequence,42.6%,Medium,0.06265630749555627, https://leetcode.com/problems/longest-increasing-subsequence
359,Logger Rate Limiter,70.8%,Easy,0.0467617659080393, https://leetcode.com/problems/logger-rate-limiter
150,Evaluate Reverse Polish Notation,36.3%,Medium,0.031526253646773944, https://leetcode.com/problems/evaluate-reverse-polish-notation
284,Peeking Iterator,45.7%,Medium,0.03110670713225487, https://leetcode.com/problems/peeking-iterator
547,Friend Circles,58.6%,Medium,0.027307522052851193, https://leetcode.com/problems/friend-circles
98,Validate Binary Search Tree,27.8%,Medium,0.026187123416340663, https://leetcode.com/problems/validate-binary-search-tree
31,Next Permutation,32.6%,Medium,0.023747034562878154, https://leetcode.com/problems/next-permutation
540,Single Element in a Sorted Array,57.9%,Medium,0.0192128868599912, https://leetcode.com/problems/single-element-in-a-sorted-array
872,Leaf-Similar Trees,64.5%,Easy,0.01752125418714782, https://leetcode.com/problems/leaf-similar-trees
23,Merge k Sorted Lists,40.2%,Hard,0.016108271385328228, https://leetcode.com/problems/merge-k-sorted-lists
701,Insert into a Binary Search Tree,77.7%,Medium,0.015522236371561826, https://leetcode.com/problems/insert-into-a-binary-search-tree
528,Random Pick with Weight,43.9%,Medium,0.014831565905995232, https://leetcode.com/problems/random-pick-with-weight
20,Valid Parentheses,39.0%,Easy,0.014292491180025941, https://leetcode.com/problems/valid-parentheses
123,Best Time to Buy and Sell Stock III,37.5%,Hard,0.011261380272539033, https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii
647,Palindromic Substrings,60.6%,Medium,0.010400509768078022, https://leetcode.com/problems/palindromic-substrings
46,Permutations,63.5%,Medium,0.009461803137288448, https://leetcode.com/problems/permutations
173,Binary Search Tree Iterator,56.6%,Medium,0.008489015324911316, https://leetcode.com/problems/binary-search-tree-iterator
394,Decode String,50.0%,Medium,0.008166644000272283, https://leetcode.com/problems/decode-string
200,Number of Islands,46.8%,Medium,0.006490251382779317, https://leetcode.com/problems/number-of-islands
543,Diameter of Binary Tree,48.4%,Easy,0.005305755914149804, https://leetcode.com/problems/diameter-of-binary-tree
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.004714210262726446, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
22,Generate Parentheses,62.7%,Medium,0.0043611059090124735, https://leetcode.com/problems/generate-parentheses
78,Subsets,62.0%,Medium,0.00368765975195334, https://leetcode.com/problems/subsets
102,Binary Tree Level Order Traversal,54.6%,Medium,0.003639014205004082, https://leetcode.com/problems/binary-tree-level-order-traversal
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.003496778759264278, https://leetcode.com/problems/longest-substring-without-repeating-characters
101,Symmetric Tree,46.8%,Easy,0.0034057078469827435, https://leetcode.com/problems/symmetric-tree
53,Maximum Subarray,46.5%,Easy,0.002167082872150794, https://leetcode.com/problems/maximum-subarray
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0021239321954525975, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
1 366 ID Find Leaves of Binary Tree Title 70.6% Acceptance Medium Difficulty 0.22834203521080285 Frequency https://leetcode.com/problems/find-leaves-of-binary-tree Leetcode Question Link
2 860 366 Lemonade Change Find Leaves of Binary Tree 51.6% 70.6% Easy Medium 0.18866903222469833 0.22834203521080285 https://leetcode.com/problems/lemonade-change https://leetcode.com/problems/find-leaves-of-binary-tree
3 362 860 Design Hit Counter Lemonade Change 63.7% 51.6% Medium Easy 0.1489960292385938 0.18866903222469833 https://leetcode.com/problems/design-hit-counter https://leetcode.com/problems/lemonade-change
4 981 362 Time Based Key-Value Store Design Hit Counter 53.1% 63.7% Medium Medium 0.1316303182973487 0.1489960292385938 https://leetcode.com/problems/time-based-key-value-store https://leetcode.com/problems/design-hit-counter
5 1120 981 Maximum Average Subtree Time Based Key-Value Store 61.9% 53.1% Medium Medium 0.12879510820557039 0.1316303182973487 https://leetcode.com/problems/maximum-average-subtree https://leetcode.com/problems/time-based-key-value-store
6 1071 1120 Greatest Common Divisor of Strings Maximum Average Subtree 52.9% 61.9% Easy Medium 0.12182344519338843 0.12879510820557039 https://leetcode.com/problems/greatest-common-divisor-of-strings https://leetcode.com/problems/maximum-average-subtree
7 17 1071 Letter Combinations of a Phone Number Greatest Common Divisor of Strings 46.8% 52.9% Medium Easy 0.1046212990833672 0.12182344519338843 https://leetcode.com/problems/letter-combinations-of-a-phone-number https://leetcode.com/problems/greatest-common-divisor-of-strings
8 1223 17 Dice Roll Simulation Letter Combinations of a Phone Number 45.6% 46.8% Medium Medium 0.10212949507637983 0.1046212990833672 https://leetcode.com/problems/dice-roll-simulation https://leetcode.com/problems/letter-combinations-of-a-phone-number
9 1366 1223 Rank Teams by Votes Dice Roll Simulation 53.8% 45.6% Medium Medium 0.07223355735937158 0.10212949507637983 https://leetcode.com/problems/rank-teams-by-votes https://leetcode.com/problems/dice-roll-simulation
10 706 1366 Design HashMap Rank Teams by Votes 61.3% 53.8% Easy Medium 0.0683442674369718 0.07223355735937158 https://leetcode.com/problems/design-hashmap https://leetcode.com/problems/rank-teams-by-votes
11 300 706 Longest Increasing Subsequence Design HashMap 42.6% 61.3% Medium Easy 0.06265630749555627 0.0683442674369718 https://leetcode.com/problems/longest-increasing-subsequence https://leetcode.com/problems/design-hashmap
12 359 300 Logger Rate Limiter Longest Increasing Subsequence 70.8% 42.6% Easy Medium 0.0467617659080393 0.06265630749555627 https://leetcode.com/problems/logger-rate-limiter https://leetcode.com/problems/longest-increasing-subsequence
13 150 359 Evaluate Reverse Polish Notation Logger Rate Limiter 36.3% 70.8% Medium Easy 0.031526253646773944 0.0467617659080393 https://leetcode.com/problems/evaluate-reverse-polish-notation https://leetcode.com/problems/logger-rate-limiter
14 284 150 Peeking Iterator Evaluate Reverse Polish Notation 45.7% 36.3% Medium Medium 0.03110670713225487 0.031526253646773944 https://leetcode.com/problems/peeking-iterator https://leetcode.com/problems/evaluate-reverse-polish-notation
15 547 284 Friend Circles Peeking Iterator 58.6% 45.7% Medium Medium 0.027307522052851193 0.03110670713225487 https://leetcode.com/problems/friend-circles https://leetcode.com/problems/peeking-iterator
16 98 547 Validate Binary Search Tree Friend Circles 27.8% 58.6% Medium Medium 0.026187123416340663 0.027307522052851193 https://leetcode.com/problems/validate-binary-search-tree https://leetcode.com/problems/friend-circles
17 31 98 Next Permutation Validate Binary Search Tree 32.6% 27.8% Medium Medium 0.023747034562878154 0.026187123416340663 https://leetcode.com/problems/next-permutation https://leetcode.com/problems/validate-binary-search-tree
18 540 31 Single Element in a Sorted Array Next Permutation 57.9% 32.6% Medium Medium 0.0192128868599912 0.023747034562878154 https://leetcode.com/problems/single-element-in-a-sorted-array https://leetcode.com/problems/next-permutation
19 872 540 Leaf-Similar Trees Single Element in a Sorted Array 64.5% 57.9% Easy Medium 0.01752125418714782 0.0192128868599912 https://leetcode.com/problems/leaf-similar-trees https://leetcode.com/problems/single-element-in-a-sorted-array
20 23 872 Merge k Sorted Lists Leaf-Similar Trees 40.2% 64.5% Hard Easy 0.016108271385328228 0.01752125418714782 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/leaf-similar-trees
21 701 23 Insert into a Binary Search Tree Merge k Sorted Lists 77.7% 40.2% Medium Hard 0.015522236371561826 0.016108271385328228 https://leetcode.com/problems/insert-into-a-binary-search-tree https://leetcode.com/problems/merge-k-sorted-lists
22 528 701 Random Pick with Weight Insert into a Binary Search Tree 43.9% 77.7% Medium Medium 0.014831565905995232 0.015522236371561826 https://leetcode.com/problems/random-pick-with-weight https://leetcode.com/problems/insert-into-a-binary-search-tree
23 20 528 Valid Parentheses Random Pick with Weight 39.0% 43.9% Easy Medium 0.014292491180025941 0.014831565905995232 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/random-pick-with-weight
24 123 20 Best Time to Buy and Sell Stock III Valid Parentheses 37.5% 39.0% Hard Easy 0.011261380272539033 0.014292491180025941 https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii https://leetcode.com/problems/valid-parentheses
25 647 123 Palindromic Substrings Best Time to Buy and Sell Stock III 60.6% 37.5% Medium Hard 0.010400509768078022 0.011261380272539033 https://leetcode.com/problems/palindromic-substrings https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii
26 46 647 Permutations Palindromic Substrings 63.5% 60.6% Medium Medium 0.009461803137288448 0.010400509768078022 https://leetcode.com/problems/permutations https://leetcode.com/problems/palindromic-substrings
27 173 46 Binary Search Tree Iterator Permutations 56.6% 63.5% Medium Medium 0.008489015324911316 0.009461803137288448 https://leetcode.com/problems/binary-search-tree-iterator https://leetcode.com/problems/permutations
28 394 173 Decode String Binary Search Tree Iterator 50.0% 56.6% Medium Medium 0.008166644000272283 0.008489015324911316 https://leetcode.com/problems/decode-string https://leetcode.com/problems/binary-search-tree-iterator
29 200 394 Number of Islands Decode String 46.8% 50.0% Medium Medium 0.006490251382779317 0.008166644000272283 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/decode-string
30 543 200 Diameter of Binary Tree Number of Islands 48.4% 46.8% Easy Medium 0.005305755914149804 0.006490251382779317 https://leetcode.com/problems/diameter-of-binary-tree https://leetcode.com/problems/number-of-islands
31 236 543 Lowest Common Ancestor of a Binary Tree Diameter of Binary Tree 45.7% 48.4% Medium Easy 0.004714210262726446 0.005305755914149804 https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree https://leetcode.com/problems/diameter-of-binary-tree
32 22 236 Generate Parentheses Lowest Common Ancestor of a Binary Tree 62.7% 45.7% Medium Medium 0.0043611059090124735 0.004714210262726446 https://leetcode.com/problems/generate-parentheses https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
33 78 22 Subsets Generate Parentheses 62.0% 62.7% Medium Medium 0.00368765975195334 0.0043611059090124735 https://leetcode.com/problems/subsets https://leetcode.com/problems/generate-parentheses
34 102 78 Binary Tree Level Order Traversal Subsets 54.6% 62.0% Medium Medium 0.003639014205004082 0.00368765975195334 https://leetcode.com/problems/binary-tree-level-order-traversal https://leetcode.com/problems/subsets
35 3 102 Longest Substring Without Repeating Characters Binary Tree Level Order Traversal 30.4% 54.6% Medium Medium 0.003496778759264278 0.003639014205004082 https://leetcode.com/problems/longest-substring-without-repeating-characters https://leetcode.com/problems/binary-tree-level-order-traversal
36 101 3 Symmetric Tree Longest Substring Without Repeating Characters 46.8% 30.4% Easy Medium 0.0034057078469827435 0.003496778759264278 https://leetcode.com/problems/symmetric-tree https://leetcode.com/problems/longest-substring-without-repeating-characters
37 53 101 Maximum Subarray Symmetric Tree 46.5% 46.8% Easy Easy 0.002167082872150794 0.0034057078469827435 https://leetcode.com/problems/maximum-subarray https://leetcode.com/problems/symmetric-tree
38 121 53 Best Time to Buy and Sell Stock Maximum Subarray 50.5% 46.5% Easy Easy 0.0021239321954525975 0.002167082872150794 https://leetcode.com/problems/best-time-to-buy-and-sell-stock https://leetcode.com/problems/maximum-subarray
39 121 Best Time to Buy and Sell Stock 50.5% Easy 0.0021239321954525975 https://leetcode.com/problems/best-time-to-buy-and-sell-stock