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,18 +1,19 @@
487,Max Consecutive Ones II,48.5%,Medium,0.03644483834479416, https://leetcode.com/problems/max-consecutive-ones-ii
281,Zigzag Iterator,58.4%,Medium,0.034926034605810494, https://leetcode.com/problems/zigzag-iterator
283,Move Zeroes,57.8%,Easy,0.024557850781664083, https://leetcode.com/problems/move-zeroes
567,Permutation in String,44.4%,Medium,0.014189666957517671, https://leetcode.com/problems/permutation-in-string
150,Evaluate Reverse Polish Notation,36.3%,Medium,0.01355493475171521, https://leetcode.com/problems/evaluate-reverse-polish-notation
56,Merge Intervals,39.3%,Medium,0.013186279740090647, https://leetcode.com/problems/merge-intervals
380,Insert Delete GetRandom O(1),47.5%,Medium,0.00934149716911291, https://leetcode.com/problems/insert-delete-getrandom-o1
279,Perfect Squares,47.4%,Medium,0.008781615160384712, https://leetcode.com/problems/perfect-squares
98,Validate Binary Search Tree,27.8%,Medium,0.0063060747091605324, https://leetcode.com/problems/validate-binary-search-tree
21,Merge Two Sorted Lists,53.5%,Easy,0.004849147433009811, https://leetcode.com/problems/merge-two-sorted-lists
146,LRU Cache,33.2%,Medium,0.004370636328108912, https://leetcode.com/problems/lru-cache
22,Generate Parentheses,62.7%,Medium,0.004152398782798953, https://leetcode.com/problems/generate-parentheses
125,Valid Palindrome,36.7%,Easy,0.0037979536727587773, https://leetcode.com/problems/valid-palindrome
49,Group Anagrams,56.9%,Medium,0.0036347154963361594, https://leetcode.com/problems/group-anagrams
33,Search in Rotated Sorted Array,34.5%,Medium,0.0031000567336666443, https://leetcode.com/problems/search-in-rotated-sorted-array
88,Merge Sorted Array,39.4%,Easy,0.002885588497720344, https://leetcode.com/problems/merge-sorted-array
206,Reverse Linked List,62.5%,Easy,0.002231770161393673, https://leetcode.com/problems/reverse-linked-list
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.0014852223137141987, https://leetcode.com/problems/longest-substring-without-repeating-characters
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
487,Max Consecutive Ones II,48.5%,Medium,0.03644483834479416, https://leetcode.com/problems/max-consecutive-ones-ii
281,Zigzag Iterator,58.4%,Medium,0.034926034605810494, https://leetcode.com/problems/zigzag-iterator
283,Move Zeroes,57.8%,Easy,0.024557850781664083, https://leetcode.com/problems/move-zeroes
567,Permutation in String,44.4%,Medium,0.014189666957517671, https://leetcode.com/problems/permutation-in-string
150,Evaluate Reverse Polish Notation,36.3%,Medium,0.01355493475171521, https://leetcode.com/problems/evaluate-reverse-polish-notation
56,Merge Intervals,39.3%,Medium,0.013186279740090647, https://leetcode.com/problems/merge-intervals
380,Insert Delete GetRandom O(1),47.5%,Medium,0.00934149716911291, https://leetcode.com/problems/insert-delete-getrandom-o1
279,Perfect Squares,47.4%,Medium,0.008781615160384712, https://leetcode.com/problems/perfect-squares
98,Validate Binary Search Tree,27.8%,Medium,0.0063060747091605324, https://leetcode.com/problems/validate-binary-search-tree
21,Merge Two Sorted Lists,53.5%,Easy,0.004849147433009811, https://leetcode.com/problems/merge-two-sorted-lists
146,LRU Cache,33.2%,Medium,0.004370636328108912, https://leetcode.com/problems/lru-cache
22,Generate Parentheses,62.7%,Medium,0.004152398782798953, https://leetcode.com/problems/generate-parentheses
125,Valid Palindrome,36.7%,Easy,0.0037979536727587773, https://leetcode.com/problems/valid-palindrome
49,Group Anagrams,56.9%,Medium,0.0036347154963361594, https://leetcode.com/problems/group-anagrams
33,Search in Rotated Sorted Array,34.5%,Medium,0.0031000567336666443, https://leetcode.com/problems/search-in-rotated-sorted-array
88,Merge Sorted Array,39.4%,Easy,0.002885588497720344, https://leetcode.com/problems/merge-sorted-array
206,Reverse Linked List,62.5%,Easy,0.002231770161393673, https://leetcode.com/problems/reverse-linked-list
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.0014852223137141987, https://leetcode.com/problems/longest-substring-without-repeating-characters
1 487 ID Max Consecutive Ones II Title 48.5% Acceptance Medium Difficulty 0.03644483834479416 Frequency https://leetcode.com/problems/max-consecutive-ones-ii Leetcode Question Link
2 281 487 Zigzag Iterator Max Consecutive Ones II 58.4% 48.5% Medium Medium 0.034926034605810494 0.03644483834479416 https://leetcode.com/problems/zigzag-iterator https://leetcode.com/problems/max-consecutive-ones-ii
3 283 281 Move Zeroes Zigzag Iterator 57.8% 58.4% Easy Medium 0.024557850781664083 0.034926034605810494 https://leetcode.com/problems/move-zeroes https://leetcode.com/problems/zigzag-iterator
4 567 283 Permutation in String Move Zeroes 44.4% 57.8% Medium Easy 0.014189666957517671 0.024557850781664083 https://leetcode.com/problems/permutation-in-string https://leetcode.com/problems/move-zeroes
5 150 567 Evaluate Reverse Polish Notation Permutation in String 36.3% 44.4% Medium Medium 0.01355493475171521 0.014189666957517671 https://leetcode.com/problems/evaluate-reverse-polish-notation https://leetcode.com/problems/permutation-in-string
6 56 150 Merge Intervals Evaluate Reverse Polish Notation 39.3% 36.3% Medium Medium 0.013186279740090647 0.01355493475171521 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/evaluate-reverse-polish-notation
7 380 56 Insert Delete GetRandom O(1) Merge Intervals 47.5% 39.3% Medium Medium 0.00934149716911291 0.013186279740090647 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/merge-intervals
8 279 380 Perfect Squares Insert Delete GetRandom O(1) 47.4% 47.5% Medium Medium 0.008781615160384712 0.00934149716911291 https://leetcode.com/problems/perfect-squares https://leetcode.com/problems/insert-delete-getrandom-o1
9 98 279 Validate Binary Search Tree Perfect Squares 27.8% 47.4% Medium Medium 0.0063060747091605324 0.008781615160384712 https://leetcode.com/problems/validate-binary-search-tree https://leetcode.com/problems/perfect-squares
10 21 98 Merge Two Sorted Lists Validate Binary Search Tree 53.5% 27.8% Easy Medium 0.004849147433009811 0.0063060747091605324 https://leetcode.com/problems/merge-two-sorted-lists https://leetcode.com/problems/validate-binary-search-tree
11 146 21 LRU Cache Merge Two Sorted Lists 33.2% 53.5% Medium Easy 0.004370636328108912 0.004849147433009811 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/merge-two-sorted-lists
12 22 146 Generate Parentheses LRU Cache 62.7% 33.2% Medium Medium 0.004152398782798953 0.004370636328108912 https://leetcode.com/problems/generate-parentheses https://leetcode.com/problems/lru-cache
13 125 22 Valid Palindrome Generate Parentheses 36.7% 62.7% Easy Medium 0.0037979536727587773 0.004152398782798953 https://leetcode.com/problems/valid-palindrome https://leetcode.com/problems/generate-parentheses
14 49 125 Group Anagrams Valid Palindrome 56.9% 36.7% Medium Easy 0.0036347154963361594 0.0037979536727587773 https://leetcode.com/problems/group-anagrams https://leetcode.com/problems/valid-palindrome
15 33 49 Search in Rotated Sorted Array Group Anagrams 34.5% 56.9% Medium Medium 0.0031000567336666443 0.0036347154963361594 https://leetcode.com/problems/search-in-rotated-sorted-array https://leetcode.com/problems/group-anagrams
16 88 33 Merge Sorted Array Search in Rotated Sorted Array 39.4% 34.5% Easy Medium 0.002885588497720344 0.0031000567336666443 https://leetcode.com/problems/merge-sorted-array https://leetcode.com/problems/search-in-rotated-sorted-array
17 206 88 Reverse Linked List Merge Sorted Array 62.5% 39.4% Easy Easy 0.002231770161393673 0.002885588497720344 https://leetcode.com/problems/reverse-linked-list https://leetcode.com/problems/merge-sorted-array
18 3 206 Longest Substring Without Repeating Characters Reverse Linked List 30.4% 62.5% Medium Easy 0.0014852223137141987 0.002231770161393673 https://leetcode.com/problems/longest-substring-without-repeating-characters https://leetcode.com/problems/reverse-linked-list
19 3 Longest Substring Without Repeating Characters 30.4% Medium 0.0014852223137141987 https://leetcode.com/problems/longest-substring-without-repeating-characters