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,22 +1,23 @@
1071,Greatest Common Divisor of Strings,52.9%,Easy,0.11954237676819192, https://leetcode.com/problems/greatest-common-divisor-of-strings
366,Find Leaves of Binary Tree,70.6%,Medium,0.1180240366638968, https://leetcode.com/problems/find-leaves-of-binary-tree
1223,Dice Roll Simulation,45.6%,Medium,0.10212949507637983, https://leetcode.com/problems/dice-roll-simulation
362,Design Hit Counter,63.7%,Medium,0.09787757530957068, https://leetcode.com/problems/design-hit-counter
981,Time Based Key-Value Store,53.1%,Medium,0.08621383525234454, https://leetcode.com/problems/time-based-key-value-store
1366,Rank Teams by Votes,53.8%,Medium,0.07223355735937158, https://leetcode.com/problems/rank-teams-by-votes
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
17,Letter Combinations of a Phone Number,46.8%,Medium,0.03893646375009422, https://leetcode.com/problems/letter-combinations-of-a-phone-number
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
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
98,Validate Binary Search Tree,27.8%,Medium,0.01825801101705589, https://leetcode.com/problems/validate-binary-search-tree
706,Design HashMap,61.3%,Easy,0.01752893260576219, https://leetcode.com/problems/design-hashmap
872,Leaf-Similar Trees,64.5%,Easy,0.01752125418714782, https://leetcode.com/problems/leaf-similar-trees
173,Binary Search Tree Iterator,56.6%,Medium,0.008489015324911316, https://leetcode.com/problems/binary-search-tree-iterator
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
46,Permutations,63.5%,Medium,0.004216302230139218, https://leetcode.com/problems/permutations
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.0015556336509412823, https://leetcode.com/problems/longest-substring-without-repeating-characters
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1071,Greatest Common Divisor of Strings,52.9%,Easy,0.11954237676819192, https://leetcode.com/problems/greatest-common-divisor-of-strings
366,Find Leaves of Binary Tree,70.6%,Medium,0.1180240366638968, https://leetcode.com/problems/find-leaves-of-binary-tree
1223,Dice Roll Simulation,45.6%,Medium,0.10212949507637983, https://leetcode.com/problems/dice-roll-simulation
362,Design Hit Counter,63.7%,Medium,0.09787757530957068, https://leetcode.com/problems/design-hit-counter
981,Time Based Key-Value Store,53.1%,Medium,0.08621383525234454, https://leetcode.com/problems/time-based-key-value-store
1366,Rank Teams by Votes,53.8%,Medium,0.07223355735937158, https://leetcode.com/problems/rank-teams-by-votes
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
17,Letter Combinations of a Phone Number,46.8%,Medium,0.03893646375009422, https://leetcode.com/problems/letter-combinations-of-a-phone-number
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
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
98,Validate Binary Search Tree,27.8%,Medium,0.01825801101705589, https://leetcode.com/problems/validate-binary-search-tree
706,Design HashMap,61.3%,Easy,0.01752893260576219, https://leetcode.com/problems/design-hashmap
872,Leaf-Similar Trees,64.5%,Easy,0.01752125418714782, https://leetcode.com/problems/leaf-similar-trees
173,Binary Search Tree Iterator,56.6%,Medium,0.008489015324911316, https://leetcode.com/problems/binary-search-tree-iterator
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
46,Permutations,63.5%,Medium,0.004216302230139218, https://leetcode.com/problems/permutations
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.0015556336509412823, https://leetcode.com/problems/longest-substring-without-repeating-characters
1 1071 ID Greatest Common Divisor of Strings Title 52.9% Acceptance Easy Difficulty 0.11954237676819192 Frequency https://leetcode.com/problems/greatest-common-divisor-of-strings Leetcode Question Link
2 366 1071 Find Leaves of Binary Tree Greatest Common Divisor of Strings 70.6% 52.9% Medium Easy 0.1180240366638968 0.11954237676819192 https://leetcode.com/problems/find-leaves-of-binary-tree https://leetcode.com/problems/greatest-common-divisor-of-strings
3 1223 366 Dice Roll Simulation Find Leaves of Binary Tree 45.6% 70.6% Medium Medium 0.10212949507637983 0.1180240366638968 https://leetcode.com/problems/dice-roll-simulation https://leetcode.com/problems/find-leaves-of-binary-tree
4 362 1223 Design Hit Counter Dice Roll Simulation 63.7% 45.6% Medium Medium 0.09787757530957068 0.10212949507637983 https://leetcode.com/problems/design-hit-counter https://leetcode.com/problems/dice-roll-simulation
5 981 362 Time Based Key-Value Store Design Hit Counter 53.1% 63.7% Medium Medium 0.08621383525234454 0.09787757530957068 https://leetcode.com/problems/time-based-key-value-store https://leetcode.com/problems/design-hit-counter
6 1366 981 Rank Teams by Votes Time Based Key-Value Store 53.8% 53.1% Medium Medium 0.07223355735937158 0.08621383525234454 https://leetcode.com/problems/rank-teams-by-votes https://leetcode.com/problems/time-based-key-value-store
7 300 1366 Longest Increasing Subsequence Rank Teams by Votes 42.6% 53.8% Medium Medium 0.06265630749555627 0.07223355735937158 https://leetcode.com/problems/longest-increasing-subsequence https://leetcode.com/problems/rank-teams-by-votes
8 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
9 17 359 Letter Combinations of a Phone Number Logger Rate Limiter 46.8% 70.8% Medium Easy 0.03893646375009422 0.0467617659080393 https://leetcode.com/problems/letter-combinations-of-a-phone-number https://leetcode.com/problems/logger-rate-limiter
10 150 17 Evaluate Reverse Polish Notation Letter Combinations of a Phone Number 36.3% 46.8% Medium Medium 0.031526253646773944 0.03893646375009422 https://leetcode.com/problems/evaluate-reverse-polish-notation https://leetcode.com/problems/letter-combinations-of-a-phone-number
11 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
12 31 284 Next Permutation Peeking Iterator 32.6% 45.7% Medium Medium 0.023747034562878154 0.03110670713225487 https://leetcode.com/problems/next-permutation https://leetcode.com/problems/peeking-iterator
13 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
14 98 540 Validate Binary Search Tree Single Element in a Sorted Array 27.8% 57.9% Medium Medium 0.01825801101705589 0.0192128868599912 https://leetcode.com/problems/validate-binary-search-tree https://leetcode.com/problems/single-element-in-a-sorted-array
15 706 98 Design HashMap Validate Binary Search Tree 61.3% 27.8% Easy Medium 0.01752893260576219 0.01825801101705589 https://leetcode.com/problems/design-hashmap https://leetcode.com/problems/validate-binary-search-tree
16 872 706 Leaf-Similar Trees Design HashMap 64.5% 61.3% Easy Easy 0.01752125418714782 0.01752893260576219 https://leetcode.com/problems/leaf-similar-trees https://leetcode.com/problems/design-hashmap
17 173 872 Binary Search Tree Iterator Leaf-Similar Trees 56.6% 64.5% Medium Easy 0.008489015324911316 0.01752125418714782 https://leetcode.com/problems/binary-search-tree-iterator https://leetcode.com/problems/leaf-similar-trees
18 236 173 Lowest Common Ancestor of a Binary Tree Binary Search Tree Iterator 45.7% 56.6% Medium Medium 0.004714210262726446 0.008489015324911316 https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree https://leetcode.com/problems/binary-search-tree-iterator
19 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
20 46 22 Permutations Generate Parentheses 63.5% 62.7% Medium Medium 0.004216302230139218 0.0043611059090124735 https://leetcode.com/problems/permutations https://leetcode.com/problems/generate-parentheses
21 102 46 Binary Tree Level Order Traversal Permutations 54.6% 63.5% Medium Medium 0.003639014205004082 0.004216302230139218 https://leetcode.com/problems/binary-tree-level-order-traversal https://leetcode.com/problems/permutations
22 3 102 Longest Substring Without Repeating Characters Binary Tree Level Order Traversal 30.4% 54.6% Medium Medium 0.0015556336509412823 0.003639014205004082 https://leetcode.com/problems/longest-substring-without-repeating-characters https://leetcode.com/problems/binary-tree-level-order-traversal
23 3 Longest Substring Without Repeating Characters 30.4% Medium 0.0015556336509412823 https://leetcode.com/problems/longest-substring-without-repeating-characters