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,24 +1,25 @@
146,LRU Cache,33.2%,Medium,0.06230548855614676, https://leetcode.com/problems/lru-cache
981,Time Based Key-Value Store,53.1%,Medium,0.049406315387071284, https://leetcode.com/problems/time-based-key-value-store
97,Interleaving String,31.5%,Hard,0.04548535439411653, https://leetcode.com/problems/interleaving-string
706,Design HashMap,61.3%,Easy,0.039016652342451774, https://leetcode.com/problems/design-hashmap
697,Degree of an Array,53.8%,Easy,0.03226086221822144, https://leetcode.com/problems/degree-of-an-array
1048,Longest String Chain,54.7%,Medium,0.019361689049145963, https://leetcode.com/problems/longest-string-chain
80,Remove Duplicates from Sorted Array II,44.0%,Medium,0.014815085785140639, https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii
20,Valid Parentheses,39.0%,Easy,0.014292491180025941, https://leetcode.com/problems/valid-parentheses
150,Evaluate Reverse Polish Notation,36.3%,Medium,0.01413451093490476, https://leetcode.com/problems/evaluate-reverse-polish-notation
56,Merge Intervals,39.3%,Medium,0.013819532422258866, https://leetcode.com/problems/merge-intervals
733,Flood Fill,55.3%,Easy,0.011217167530924988, https://leetcode.com/problems/flood-fill
905,Sort Array By Parity,74.1%,Easy,0.009603915354180344, https://leetcode.com/problems/sort-array-by-parity
63,Unique Paths II,34.6%,Medium,0.008712753874961187, https://leetcode.com/problems/unique-paths-ii
49,Group Anagrams,56.9%,Medium,0.008538951314232168, https://leetcode.com/problems/group-anagrams
23,Merge k Sorted Lists,40.2%,Hard,0.004051459000748015, https://leetcode.com/problems/merge-k-sorted-lists
977,Squares of a Sorted Array,72.1%,Easy,0.003891055492966611, https://leetcode.com/problems/squares-of-a-sorted-array
8,String to Integer (atoi),15.4%,Medium,0.0037925521897059712, https://leetcode.com/problems/string-to-integer-atoi
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.003496778759264278, https://leetcode.com/problems/longest-substring-without-repeating-characters
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
33,Search in Rotated Sorted Array,34.5%,Medium,0.003229976968332634, https://leetcode.com/problems/search-in-rotated-sorted-array
98,Validate Binary Search Tree,27.8%,Medium,0.002943776044013381, https://leetcode.com/problems/validate-binary-search-tree
21,Merge Two Sorted Lists,53.5%,Easy,0.0022551737583973706, https://leetcode.com/problems/merge-two-sorted-lists
15,3Sum,26.8%,Medium,0.0021990113314367685, https://leetcode.com/problems/3sum
2,Add Two Numbers,33.9%,Medium,0.0016886191111440908, https://leetcode.com/problems/add-two-numbers
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
146,LRU Cache,33.2%,Medium,0.06230548855614676, https://leetcode.com/problems/lru-cache
981,Time Based Key-Value Store,53.1%,Medium,0.049406315387071284, https://leetcode.com/problems/time-based-key-value-store
97,Interleaving String,31.5%,Hard,0.04548535439411653, https://leetcode.com/problems/interleaving-string
706,Design HashMap,61.3%,Easy,0.039016652342451774, https://leetcode.com/problems/design-hashmap
697,Degree of an Array,53.8%,Easy,0.03226086221822144, https://leetcode.com/problems/degree-of-an-array
1048,Longest String Chain,54.7%,Medium,0.019361689049145963, https://leetcode.com/problems/longest-string-chain
80,Remove Duplicates from Sorted Array II,44.0%,Medium,0.014815085785140639, https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii
20,Valid Parentheses,39.0%,Easy,0.014292491180025941, https://leetcode.com/problems/valid-parentheses
150,Evaluate Reverse Polish Notation,36.3%,Medium,0.01413451093490476, https://leetcode.com/problems/evaluate-reverse-polish-notation
56,Merge Intervals,39.3%,Medium,0.013819532422258866, https://leetcode.com/problems/merge-intervals
733,Flood Fill,55.3%,Easy,0.011217167530924988, https://leetcode.com/problems/flood-fill
905,Sort Array By Parity,74.1%,Easy,0.009603915354180344, https://leetcode.com/problems/sort-array-by-parity
63,Unique Paths II,34.6%,Medium,0.008712753874961187, https://leetcode.com/problems/unique-paths-ii
49,Group Anagrams,56.9%,Medium,0.008538951314232168, https://leetcode.com/problems/group-anagrams
23,Merge k Sorted Lists,40.2%,Hard,0.004051459000748015, https://leetcode.com/problems/merge-k-sorted-lists
977,Squares of a Sorted Array,72.1%,Easy,0.003891055492966611, https://leetcode.com/problems/squares-of-a-sorted-array
8,String to Integer (atoi),15.4%,Medium,0.0037925521897059712, https://leetcode.com/problems/string-to-integer-atoi
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.003496778759264278, https://leetcode.com/problems/longest-substring-without-repeating-characters
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
33,Search in Rotated Sorted Array,34.5%,Medium,0.003229976968332634, https://leetcode.com/problems/search-in-rotated-sorted-array
98,Validate Binary Search Tree,27.8%,Medium,0.002943776044013381, https://leetcode.com/problems/validate-binary-search-tree
21,Merge Two Sorted Lists,53.5%,Easy,0.0022551737583973706, https://leetcode.com/problems/merge-two-sorted-lists
15,3Sum,26.8%,Medium,0.0021990113314367685, https://leetcode.com/problems/3sum
2,Add Two Numbers,33.9%,Medium,0.0016886191111440908, https://leetcode.com/problems/add-two-numbers
1 146 ID LRU Cache Title 33.2% Acceptance Medium Difficulty 0.06230548855614676 Frequency https://leetcode.com/problems/lru-cache Leetcode Question Link
2 981 146 Time Based Key-Value Store LRU Cache 53.1% 33.2% Medium Medium 0.049406315387071284 0.06230548855614676 https://leetcode.com/problems/time-based-key-value-store https://leetcode.com/problems/lru-cache
3 97 981 Interleaving String Time Based Key-Value Store 31.5% 53.1% Hard Medium 0.04548535439411653 0.049406315387071284 https://leetcode.com/problems/interleaving-string https://leetcode.com/problems/time-based-key-value-store
4 706 97 Design HashMap Interleaving String 61.3% 31.5% Easy Hard 0.039016652342451774 0.04548535439411653 https://leetcode.com/problems/design-hashmap https://leetcode.com/problems/interleaving-string
5 697 706 Degree of an Array Design HashMap 53.8% 61.3% Easy Easy 0.03226086221822144 0.039016652342451774 https://leetcode.com/problems/degree-of-an-array https://leetcode.com/problems/design-hashmap
6 1048 697 Longest String Chain Degree of an Array 54.7% 53.8% Medium Easy 0.019361689049145963 0.03226086221822144 https://leetcode.com/problems/longest-string-chain https://leetcode.com/problems/degree-of-an-array
7 80 1048 Remove Duplicates from Sorted Array II Longest String Chain 44.0% 54.7% Medium Medium 0.014815085785140639 0.019361689049145963 https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii https://leetcode.com/problems/longest-string-chain
8 20 80 Valid Parentheses Remove Duplicates from Sorted Array II 39.0% 44.0% Easy Medium 0.014292491180025941 0.014815085785140639 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii
9 150 20 Evaluate Reverse Polish Notation Valid Parentheses 36.3% 39.0% Medium Easy 0.01413451093490476 0.014292491180025941 https://leetcode.com/problems/evaluate-reverse-polish-notation https://leetcode.com/problems/valid-parentheses
10 56 150 Merge Intervals Evaluate Reverse Polish Notation 39.3% 36.3% Medium Medium 0.013819532422258866 0.01413451093490476 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/evaluate-reverse-polish-notation
11 733 56 Flood Fill Merge Intervals 55.3% 39.3% Easy Medium 0.011217167530924988 0.013819532422258866 https://leetcode.com/problems/flood-fill https://leetcode.com/problems/merge-intervals
12 905 733 Sort Array By Parity Flood Fill 74.1% 55.3% Easy Easy 0.009603915354180344 0.011217167530924988 https://leetcode.com/problems/sort-array-by-parity https://leetcode.com/problems/flood-fill
13 63 905 Unique Paths II Sort Array By Parity 34.6% 74.1% Medium Easy 0.008712753874961187 0.009603915354180344 https://leetcode.com/problems/unique-paths-ii https://leetcode.com/problems/sort-array-by-parity
14 49 63 Group Anagrams Unique Paths II 56.9% 34.6% Medium Medium 0.008538951314232168 0.008712753874961187 https://leetcode.com/problems/group-anagrams https://leetcode.com/problems/unique-paths-ii
15 23 49 Merge k Sorted Lists Group Anagrams 40.2% 56.9% Hard Medium 0.004051459000748015 0.008538951314232168 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/group-anagrams
16 977 23 Squares of a Sorted Array Merge k Sorted Lists 72.1% 40.2% Easy Hard 0.003891055492966611 0.004051459000748015 https://leetcode.com/problems/squares-of-a-sorted-array https://leetcode.com/problems/merge-k-sorted-lists
17 8 977 String to Integer (atoi) Squares of a Sorted Array 15.4% 72.1% Medium Easy 0.0037925521897059712 0.003891055492966611 https://leetcode.com/problems/string-to-integer-atoi https://leetcode.com/problems/squares-of-a-sorted-array
18 3 8 Longest Substring Without Repeating Characters String to Integer (atoi) 30.4% 15.4% Medium Medium 0.003496778759264278 0.0037925521897059712 https://leetcode.com/problems/longest-substring-without-repeating-characters https://leetcode.com/problems/string-to-integer-atoi
19 1 3 Two Sum Longest Substring Without Repeating Characters 45.6% 30.4% Easy Medium 0.003278422738041615 0.003496778759264278 https://leetcode.com/problems/two-sum https://leetcode.com/problems/longest-substring-without-repeating-characters
20 33 1 Search in Rotated Sorted Array Two Sum 34.5% 45.6% Medium Easy 0.003229976968332634 0.003278422738041615 https://leetcode.com/problems/search-in-rotated-sorted-array https://leetcode.com/problems/two-sum
21 98 33 Validate Binary Search Tree Search in Rotated Sorted Array 27.8% 34.5% Medium Medium 0.002943776044013381 0.003229976968332634 https://leetcode.com/problems/validate-binary-search-tree https://leetcode.com/problems/search-in-rotated-sorted-array
22 21 98 Merge Two Sorted Lists Validate Binary Search Tree 53.5% 27.8% Easy Medium 0.0022551737583973706 0.002943776044013381 https://leetcode.com/problems/merge-two-sorted-lists https://leetcode.com/problems/validate-binary-search-tree
23 15 21 3Sum Merge Two Sorted Lists 26.8% 53.5% Medium Easy 0.0021990113314367685 0.0022551737583973706 https://leetcode.com/problems/3sum https://leetcode.com/problems/merge-two-sorted-lists
24 2 15 Add Two Numbers 3Sum 33.9% 26.8% Medium Medium 0.0016886191111440908 0.0021990113314367685 https://leetcode.com/problems/add-two-numbers https://leetcode.com/problems/3sum
25 2 Add Two Numbers 33.9% Medium 0.0016886191111440908 https://leetcode.com/problems/add-two-numbers