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,21 +1,22 @@
740,Delete and Earn,48.6%,Medium,2.0469337965260492, https://leetcode.com/problems/delete-and-earn
366,Find Leaves of Binary Tree,70.6%,Medium,1.492934381312693, https://leetcode.com/problems/find-leaves-of-binary-tree
547,Friend Circles,58.6%,Medium,0.9389349660993366, https://leetcode.com/problems/friend-circles
1010,Pairs of Songs With Total Durations Divisible by 60,47.4%,Easy,0.8080712743639388, https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
41,First Missing Positive,32.0%,Hard,0.5197501329149874, https://leetcode.com/problems/first-missing-positive
28,Implement strStr(),34.5%,Easy,0.49430861720878383, https://leetcode.com/problems/implement-strstr
133,Clone Graph,34.8%,Medium,0.4466221331933528, https://leetcode.com/problems/clone-graph
75,Sort Colors,47.3%,Medium,0.4245095320511369, https://leetcode.com/problems/sort-colors
285,Inorder Successor in BST,40.4%,Medium,0.36133895646771014, https://leetcode.com/problems/inorder-successor-in-bst
10,Regular Expression Matching,26.8%,Hard,0.15934409022264243, https://leetcode.com/problems/regular-expression-matching
214,Shortest Palindrome,29.8%,Hard,0.07220456924739427, https://leetcode.com/problems/shortest-palindrome
347,Top K Frequent Elements,61.2%,Medium,0.05152828440155634, https://leetcode.com/problems/top-k-frequent-elements
139,Word Break,40.1%,Medium,0.03329941406904932, https://leetcode.com/problems/word-break
269,Alien Dictionary,33.3%,Hard,0.027110094009475887, https://leetcode.com/problems/alien-dictionary
215,Kth Largest Element in an Array,55.4%,Medium,0.00838696557248326, https://leetcode.com/problems/kth-largest-element-in-an-array
772,Basic Calculator III,41.3%,Hard,0, https://leetcode.com/problems/basic-calculator-iii
442,Find All Duplicates in an Array,67.8%,Medium,0, https://leetcode.com/problems/find-all-duplicates-in-an-array
380,Insert Delete GetRandom O(1),47.5%,Medium,0, https://leetcode.com/problems/insert-delete-getrandom-o1
424,Longest Repeating Character Replacement,47.0%,Medium,0, https://leetcode.com/problems/longest-repeating-character-replacement
600,Non-negative Integers without Consecutive Ones,34.1%,Hard,0, https://leetcode.com/problems/non-negative-integers-without-consecutive-ones
692,Top K Frequent Words,51.8%,Medium,0, https://leetcode.com/problems/top-k-frequent-words
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
740,Delete and Earn,48.6%,Medium,2.0469337965260492, https://leetcode.com/problems/delete-and-earn
366,Find Leaves of Binary Tree,70.6%,Medium,1.492934381312693, https://leetcode.com/problems/find-leaves-of-binary-tree
547,Friend Circles,58.6%,Medium,0.9389349660993366, https://leetcode.com/problems/friend-circles
1010,Pairs of Songs With Total Durations Divisible by 60,47.4%,Easy,0.8080712743639388, https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
41,First Missing Positive,32.0%,Hard,0.5197501329149874, https://leetcode.com/problems/first-missing-positive
28,Implement strStr(),34.5%,Easy,0.49430861720878383, https://leetcode.com/problems/implement-strstr
133,Clone Graph,34.8%,Medium,0.4466221331933528, https://leetcode.com/problems/clone-graph
75,Sort Colors,47.3%,Medium,0.4245095320511369, https://leetcode.com/problems/sort-colors
285,Inorder Successor in BST,40.4%,Medium,0.36133895646771014, https://leetcode.com/problems/inorder-successor-in-bst
10,Regular Expression Matching,26.8%,Hard,0.15934409022264243, https://leetcode.com/problems/regular-expression-matching
214,Shortest Palindrome,29.8%,Hard,0.07220456924739427, https://leetcode.com/problems/shortest-palindrome
347,Top K Frequent Elements,61.2%,Medium,0.05152828440155634, https://leetcode.com/problems/top-k-frequent-elements
139,Word Break,40.1%,Medium,0.03329941406904932, https://leetcode.com/problems/word-break
269,Alien Dictionary,33.3%,Hard,0.027110094009475887, https://leetcode.com/problems/alien-dictionary
215,Kth Largest Element in an Array,55.4%,Medium,0.00838696557248326, https://leetcode.com/problems/kth-largest-element-in-an-array
772,Basic Calculator III,41.3%,Hard,0, https://leetcode.com/problems/basic-calculator-iii
442,Find All Duplicates in an Array,67.8%,Medium,0, https://leetcode.com/problems/find-all-duplicates-in-an-array
380,Insert Delete GetRandom O(1),47.5%,Medium,0, https://leetcode.com/problems/insert-delete-getrandom-o1
424,Longest Repeating Character Replacement,47.0%,Medium,0, https://leetcode.com/problems/longest-repeating-character-replacement
600,Non-negative Integers without Consecutive Ones,34.1%,Hard,0, https://leetcode.com/problems/non-negative-integers-without-consecutive-ones
692,Top K Frequent Words,51.8%,Medium,0, https://leetcode.com/problems/top-k-frequent-words
1 740 ID Delete and Earn Title 48.6% Acceptance Medium Difficulty 2.0469337965260492 Frequency https://leetcode.com/problems/delete-and-earn Leetcode Question Link
2 366 740 Find Leaves of Binary Tree Delete and Earn 70.6% 48.6% Medium Medium 1.492934381312693 2.0469337965260492 https://leetcode.com/problems/find-leaves-of-binary-tree https://leetcode.com/problems/delete-and-earn
3 547 366 Friend Circles Find Leaves of Binary Tree 58.6% 70.6% Medium Medium 0.9389349660993366 1.492934381312693 https://leetcode.com/problems/friend-circles https://leetcode.com/problems/find-leaves-of-binary-tree
4 1010 547 Pairs of Songs With Total Durations Divisible by 60 Friend Circles 47.4% 58.6% Easy Medium 0.8080712743639388 0.9389349660993366 https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60 https://leetcode.com/problems/friend-circles
5 41 1010 First Missing Positive Pairs of Songs With Total Durations Divisible by 60 32.0% 47.4% Hard Easy 0.5197501329149874 0.8080712743639388 https://leetcode.com/problems/first-missing-positive https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
6 28 41 Implement strStr() First Missing Positive 34.5% 32.0% Easy Hard 0.49430861720878383 0.5197501329149874 https://leetcode.com/problems/implement-strstr https://leetcode.com/problems/first-missing-positive
7 133 28 Clone Graph Implement strStr() 34.8% 34.5% Medium Easy 0.4466221331933528 0.49430861720878383 https://leetcode.com/problems/clone-graph https://leetcode.com/problems/implement-strstr
8 75 133 Sort Colors Clone Graph 47.3% 34.8% Medium Medium 0.4245095320511369 0.4466221331933528 https://leetcode.com/problems/sort-colors https://leetcode.com/problems/clone-graph
9 285 75 Inorder Successor in BST Sort Colors 40.4% 47.3% Medium Medium 0.36133895646771014 0.4245095320511369 https://leetcode.com/problems/inorder-successor-in-bst https://leetcode.com/problems/sort-colors
10 10 285 Regular Expression Matching Inorder Successor in BST 26.8% 40.4% Hard Medium 0.15934409022264243 0.36133895646771014 https://leetcode.com/problems/regular-expression-matching https://leetcode.com/problems/inorder-successor-in-bst
11 214 10 Shortest Palindrome Regular Expression Matching 29.8% 26.8% Hard Hard 0.07220456924739427 0.15934409022264243 https://leetcode.com/problems/shortest-palindrome https://leetcode.com/problems/regular-expression-matching
12 347 214 Top K Frequent Elements Shortest Palindrome 61.2% 29.8% Medium Hard 0.05152828440155634 0.07220456924739427 https://leetcode.com/problems/top-k-frequent-elements https://leetcode.com/problems/shortest-palindrome
13 139 347 Word Break Top K Frequent Elements 40.1% 61.2% Medium Medium 0.03329941406904932 0.05152828440155634 https://leetcode.com/problems/word-break https://leetcode.com/problems/top-k-frequent-elements
14 269 139 Alien Dictionary Word Break 33.3% 40.1% Hard Medium 0.027110094009475887 0.03329941406904932 https://leetcode.com/problems/alien-dictionary https://leetcode.com/problems/word-break
15 215 269 Kth Largest Element in an Array Alien Dictionary 55.4% 33.3% Medium Hard 0.00838696557248326 0.027110094009475887 https://leetcode.com/problems/kth-largest-element-in-an-array https://leetcode.com/problems/alien-dictionary
16 772 215 Basic Calculator III Kth Largest Element in an Array 41.3% 55.4% Hard Medium 0 0.00838696557248326 https://leetcode.com/problems/basic-calculator-iii https://leetcode.com/problems/kth-largest-element-in-an-array
17 442 772 Find All Duplicates in an Array Basic Calculator III 67.8% 41.3% Medium Hard 0 0 https://leetcode.com/problems/find-all-duplicates-in-an-array https://leetcode.com/problems/basic-calculator-iii
18 380 442 Insert Delete GetRandom O(1) Find All Duplicates in an Array 47.5% 67.8% Medium Medium 0 0 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/find-all-duplicates-in-an-array
19 424 380 Longest Repeating Character Replacement Insert Delete GetRandom O(1) 47.0% 47.5% Medium Medium 0 0 https://leetcode.com/problems/longest-repeating-character-replacement https://leetcode.com/problems/insert-delete-getrandom-o1
20 600 424 Non-negative Integers without Consecutive Ones Longest Repeating Character Replacement 34.1% 47.0% Hard Medium 0 0 https://leetcode.com/problems/non-negative-integers-without-consecutive-ones https://leetcode.com/problems/longest-repeating-character-replacement
21 692 600 Top K Frequent Words Non-negative Integers without Consecutive Ones 51.8% 34.1% Medium Hard 0 0 https://leetcode.com/problems/top-k-frequent-words https://leetcode.com/problems/non-negative-integers-without-consecutive-ones
22 692 Top K Frequent Words 51.8% Medium 0 https://leetcode.com/problems/top-k-frequent-words