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,37 +1,38 @@
599,Minimum Index Sum of Two Lists,50.7%,Easy,2.30819311902822, https://leetcode.com/problems/minimum-index-sum-of-two-lists
564,Find the Closest Palindrome,19.7%,Hard,1.686299975418363, https://leetcode.com/problems/find-the-closest-palindrome
273,Integer to English Words,27.1%,Hard,1.064406831808506, https://leetcode.com/problems/integer-to-english-words
332,Reconstruct Itinerary,36.7%,Medium,1.0408834009118708, https://leetcode.com/problems/reconstruct-itinerary
355,Design Twitter,30.3%,Medium,1.0346399906708852, https://leetcode.com/problems/design-twitter
56,Merge Intervals,39.3%,Medium,0.987222928819735, https://leetcode.com/problems/merge-intervals
49,Group Anagrams,56.9%,Medium,0.43750160048327236, https://leetcode.com/problems/group-anagrams
692,Top K Frequent Words,51.8%,Medium,0.43507396043031815, https://leetcode.com/problems/top-k-frequent-words
139,Word Break,40.1%,Medium,0.35781564515486297, https://leetcode.com/problems/word-break
218,The Skyline Problem,34.6%,Hard,0.3456466128972542, https://leetcode.com/problems/the-skyline-problem
347,Top K Frequent Elements,61.2%,Medium,0.3398753854298785, https://leetcode.com/problems/top-k-frequent-elements
1126,Active Businesses,68.5%,Medium,0.3208150073042144, https://leetcode.com/problems/active-businesses
528,Random Pick with Weight,43.9%,Medium,0.31740043778091953, https://leetcode.com/problems/random-pick-with-weight
253,Meeting Rooms II,45.7%,Medium,0.29470460870072, https://leetcode.com/problems/meeting-rooms-ii
127,Word Ladder,29.6%,Medium,0.29067608666438566, https://leetcode.com/problems/word-ladder
1333,Filter Restaurants by Vegan-Friendly & Price and Distance,54.6%,Medium,0.263911853117869, https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.20227578684440572, https://leetcode.com/problems/longest-substring-without-repeating-characters
14,Longest Common Prefix,35.4%,Easy,0.1714957284786035, https://leetcode.com/problems/longest-common-prefix
205,Isomorphic Strings,39.8%,Easy,0.1703978238463443, https://leetcode.com/problems/isomorphic-strings
126,Word Ladder II,22.1%,Hard,0.15135837956172798, https://leetcode.com/problems/word-ladder-ii
1,Two Sum,45.6%,Easy,0.1394299376526441, https://leetcode.com/problems/two-sum
22,Generate Parentheses,62.7%,Medium,0.12417283375515446, https://leetcode.com/problems/generate-parentheses
207,Course Schedule,43.1%,Medium,0.11725761496207857, https://leetcode.com/problems/course-schedule
192,Word Frequency,25.8%,Medium,0.10186917331721722, https://leetcode.com/problems/word-frequency
380,Insert Delete GetRandom O(1),47.5%,Medium,0.08509738264123867, https://leetcode.com/problems/insert-delete-getrandom-o1
784,Letter Case Permutation,64.6%,Medium,0.0787033338274549, https://leetcode.com/problems/letter-case-permutation
39,Combination Sum,56.1%,Medium,0.05030398316850793, https://leetcode.com/problems/combination-sum
239,Sliding Window Maximum,43.0%,Hard,0.031228142547585713, https://leetcode.com/problems/sliding-window-maximum
206,Reverse Linked List,62.5%,Easy,0.02086427467076072, https://leetcode.com/problems/reverse-linked-list
349,Intersection of Two Arrays,62.5%,Easy,0.016239981598488416, https://leetcode.com/problems/intersection-of-two-arrays
242,Valid Anagram,56.9%,Easy,0.009322628116274939, https://leetcode.com/problems/valid-anagram
394,Decode String,50.0%,Medium,0.008166644000272283, https://leetcode.com/problems/decode-string
151,Reverse Words in a String,21.9%,Medium,0.003456091915988908, https://leetcode.com/problems/reverse-words-in-a-string
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
443,String Compression,41.3%,Easy,0, https://leetcode.com/problems/string-compression
1436,Destination City,77.3%,Easy,0, https://leetcode.com/problems/destination-city
1455,Check If a Word Occurs As a Prefix of Any Word in a Sentence,64.6%,Easy,0, https://leetcode.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
599,Minimum Index Sum of Two Lists,50.7%,Easy,2.30819311902822, https://leetcode.com/problems/minimum-index-sum-of-two-lists
564,Find the Closest Palindrome,19.7%,Hard,1.686299975418363, https://leetcode.com/problems/find-the-closest-palindrome
273,Integer to English Words,27.1%,Hard,1.064406831808506, https://leetcode.com/problems/integer-to-english-words
332,Reconstruct Itinerary,36.7%,Medium,1.0408834009118708, https://leetcode.com/problems/reconstruct-itinerary
355,Design Twitter,30.3%,Medium,1.0346399906708852, https://leetcode.com/problems/design-twitter
56,Merge Intervals,39.3%,Medium,0.987222928819735, https://leetcode.com/problems/merge-intervals
49,Group Anagrams,56.9%,Medium,0.43750160048327236, https://leetcode.com/problems/group-anagrams
692,Top K Frequent Words,51.8%,Medium,0.43507396043031815, https://leetcode.com/problems/top-k-frequent-words
139,Word Break,40.1%,Medium,0.35781564515486297, https://leetcode.com/problems/word-break
218,The Skyline Problem,34.6%,Hard,0.3456466128972542, https://leetcode.com/problems/the-skyline-problem
347,Top K Frequent Elements,61.2%,Medium,0.3398753854298785, https://leetcode.com/problems/top-k-frequent-elements
1126,Active Businesses,68.5%,Medium,0.3208150073042144, https://leetcode.com/problems/active-businesses
528,Random Pick with Weight,43.9%,Medium,0.31740043778091953, https://leetcode.com/problems/random-pick-with-weight
253,Meeting Rooms II,45.7%,Medium,0.29470460870072, https://leetcode.com/problems/meeting-rooms-ii
127,Word Ladder,29.6%,Medium,0.29067608666438566, https://leetcode.com/problems/word-ladder
1333,Filter Restaurants by Vegan-Friendly & Price and Distance,54.6%,Medium,0.263911853117869, https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.20227578684440572, https://leetcode.com/problems/longest-substring-without-repeating-characters
14,Longest Common Prefix,35.4%,Easy,0.1714957284786035, https://leetcode.com/problems/longest-common-prefix
205,Isomorphic Strings,39.8%,Easy,0.1703978238463443, https://leetcode.com/problems/isomorphic-strings
126,Word Ladder II,22.1%,Hard,0.15135837956172798, https://leetcode.com/problems/word-ladder-ii
1,Two Sum,45.6%,Easy,0.1394299376526441, https://leetcode.com/problems/two-sum
22,Generate Parentheses,62.7%,Medium,0.12417283375515446, https://leetcode.com/problems/generate-parentheses
207,Course Schedule,43.1%,Medium,0.11725761496207857, https://leetcode.com/problems/course-schedule
192,Word Frequency,25.8%,Medium,0.10186917331721722, https://leetcode.com/problems/word-frequency
380,Insert Delete GetRandom O(1),47.5%,Medium,0.08509738264123867, https://leetcode.com/problems/insert-delete-getrandom-o1
784,Letter Case Permutation,64.6%,Medium,0.0787033338274549, https://leetcode.com/problems/letter-case-permutation
39,Combination Sum,56.1%,Medium,0.05030398316850793, https://leetcode.com/problems/combination-sum
239,Sliding Window Maximum,43.0%,Hard,0.031228142547585713, https://leetcode.com/problems/sliding-window-maximum
206,Reverse Linked List,62.5%,Easy,0.02086427467076072, https://leetcode.com/problems/reverse-linked-list
349,Intersection of Two Arrays,62.5%,Easy,0.016239981598488416, https://leetcode.com/problems/intersection-of-two-arrays
242,Valid Anagram,56.9%,Easy,0.009322628116274939, https://leetcode.com/problems/valid-anagram
394,Decode String,50.0%,Medium,0.008166644000272283, https://leetcode.com/problems/decode-string
151,Reverse Words in a String,21.9%,Medium,0.003456091915988908, https://leetcode.com/problems/reverse-words-in-a-string
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
443,String Compression,41.3%,Easy,0, https://leetcode.com/problems/string-compression
1436,Destination City,77.3%,Easy,0, https://leetcode.com/problems/destination-city
1455,Check If a Word Occurs As a Prefix of Any Word in a Sentence,64.6%,Easy,0, https://leetcode.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
1 599 ID Minimum Index Sum of Two Lists Title 50.7% Acceptance Easy Difficulty 2.30819311902822 Frequency https://leetcode.com/problems/minimum-index-sum-of-two-lists Leetcode Question Link
2 564 599 Find the Closest Palindrome Minimum Index Sum of Two Lists 19.7% 50.7% Hard Easy 1.686299975418363 2.30819311902822 https://leetcode.com/problems/find-the-closest-palindrome https://leetcode.com/problems/minimum-index-sum-of-two-lists
3 273 564 Integer to English Words Find the Closest Palindrome 27.1% 19.7% Hard Hard 1.064406831808506 1.686299975418363 https://leetcode.com/problems/integer-to-english-words https://leetcode.com/problems/find-the-closest-palindrome
4 332 273 Reconstruct Itinerary Integer to English Words 36.7% 27.1% Medium Hard 1.0408834009118708 1.064406831808506 https://leetcode.com/problems/reconstruct-itinerary https://leetcode.com/problems/integer-to-english-words
5 355 332 Design Twitter Reconstruct Itinerary 30.3% 36.7% Medium Medium 1.0346399906708852 1.0408834009118708 https://leetcode.com/problems/design-twitter https://leetcode.com/problems/reconstruct-itinerary
6 56 355 Merge Intervals Design Twitter 39.3% 30.3% Medium Medium 0.987222928819735 1.0346399906708852 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/design-twitter
7 49 56 Group Anagrams Merge Intervals 56.9% 39.3% Medium Medium 0.43750160048327236 0.987222928819735 https://leetcode.com/problems/group-anagrams https://leetcode.com/problems/merge-intervals
8 692 49 Top K Frequent Words Group Anagrams 51.8% 56.9% Medium Medium 0.43507396043031815 0.43750160048327236 https://leetcode.com/problems/top-k-frequent-words https://leetcode.com/problems/group-anagrams
9 139 692 Word Break Top K Frequent Words 40.1% 51.8% Medium Medium 0.35781564515486297 0.43507396043031815 https://leetcode.com/problems/word-break https://leetcode.com/problems/top-k-frequent-words
10 218 139 The Skyline Problem Word Break 34.6% 40.1% Hard Medium 0.3456466128972542 0.35781564515486297 https://leetcode.com/problems/the-skyline-problem https://leetcode.com/problems/word-break
11 347 218 Top K Frequent Elements The Skyline Problem 61.2% 34.6% Medium Hard 0.3398753854298785 0.3456466128972542 https://leetcode.com/problems/top-k-frequent-elements https://leetcode.com/problems/the-skyline-problem
12 1126 347 Active Businesses Top K Frequent Elements 68.5% 61.2% Medium Medium 0.3208150073042144 0.3398753854298785 https://leetcode.com/problems/active-businesses https://leetcode.com/problems/top-k-frequent-elements
13 528 1126 Random Pick with Weight Active Businesses 43.9% 68.5% Medium Medium 0.31740043778091953 0.3208150073042144 https://leetcode.com/problems/random-pick-with-weight https://leetcode.com/problems/active-businesses
14 253 528 Meeting Rooms II Random Pick with Weight 45.7% 43.9% Medium Medium 0.29470460870072 0.31740043778091953 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/random-pick-with-weight
15 127 253 Word Ladder Meeting Rooms II 29.6% 45.7% Medium Medium 0.29067608666438566 0.29470460870072 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/meeting-rooms-ii
16 1333 127 Filter Restaurants by Vegan-Friendly & Price and Distance Word Ladder 54.6% 29.6% Medium Medium 0.263911853117869 0.29067608666438566 https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance https://leetcode.com/problems/word-ladder
17 3 1333 Longest Substring Without Repeating Characters Filter Restaurants by Vegan-Friendly & Price and Distance 30.4% 54.6% Medium Medium 0.20227578684440572 0.263911853117869 https://leetcode.com/problems/longest-substring-without-repeating-characters https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance
18 14 3 Longest Common Prefix Longest Substring Without Repeating Characters 35.4% 30.4% Easy Medium 0.1714957284786035 0.20227578684440572 https://leetcode.com/problems/longest-common-prefix https://leetcode.com/problems/longest-substring-without-repeating-characters
19 205 14 Isomorphic Strings Longest Common Prefix 39.8% 35.4% Easy Easy 0.1703978238463443 0.1714957284786035 https://leetcode.com/problems/isomorphic-strings https://leetcode.com/problems/longest-common-prefix
20 126 205 Word Ladder II Isomorphic Strings 22.1% 39.8% Hard Easy 0.15135837956172798 0.1703978238463443 https://leetcode.com/problems/word-ladder-ii https://leetcode.com/problems/isomorphic-strings
21 1 126 Two Sum Word Ladder II 45.6% 22.1% Easy Hard 0.1394299376526441 0.15135837956172798 https://leetcode.com/problems/two-sum https://leetcode.com/problems/word-ladder-ii
22 22 1 Generate Parentheses Two Sum 62.7% 45.6% Medium Easy 0.12417283375515446 0.1394299376526441 https://leetcode.com/problems/generate-parentheses https://leetcode.com/problems/two-sum
23 207 22 Course Schedule Generate Parentheses 43.1% 62.7% Medium Medium 0.11725761496207857 0.12417283375515446 https://leetcode.com/problems/course-schedule https://leetcode.com/problems/generate-parentheses
24 192 207 Word Frequency Course Schedule 25.8% 43.1% Medium Medium 0.10186917331721722 0.11725761496207857 https://leetcode.com/problems/word-frequency https://leetcode.com/problems/course-schedule
25 380 192 Insert Delete GetRandom O(1) Word Frequency 47.5% 25.8% Medium Medium 0.08509738264123867 0.10186917331721722 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/word-frequency
26 784 380 Letter Case Permutation Insert Delete GetRandom O(1) 64.6% 47.5% Medium Medium 0.0787033338274549 0.08509738264123867 https://leetcode.com/problems/letter-case-permutation https://leetcode.com/problems/insert-delete-getrandom-o1
27 39 784 Combination Sum Letter Case Permutation 56.1% 64.6% Medium Medium 0.05030398316850793 0.0787033338274549 https://leetcode.com/problems/combination-sum https://leetcode.com/problems/letter-case-permutation
28 239 39 Sliding Window Maximum Combination Sum 43.0% 56.1% Hard Medium 0.031228142547585713 0.05030398316850793 https://leetcode.com/problems/sliding-window-maximum https://leetcode.com/problems/combination-sum
29 206 239 Reverse Linked List Sliding Window Maximum 62.5% 43.0% Easy Hard 0.02086427467076072 0.031228142547585713 https://leetcode.com/problems/reverse-linked-list https://leetcode.com/problems/sliding-window-maximum
30 349 206 Intersection of Two Arrays Reverse Linked List 62.5% 62.5% Easy Easy 0.016239981598488416 0.02086427467076072 https://leetcode.com/problems/intersection-of-two-arrays https://leetcode.com/problems/reverse-linked-list
31 242 349 Valid Anagram Intersection of Two Arrays 56.9% 62.5% Easy Easy 0.009322628116274939 0.016239981598488416 https://leetcode.com/problems/valid-anagram https://leetcode.com/problems/intersection-of-two-arrays
32 394 242 Decode String Valid Anagram 50.0% 56.9% Medium Easy 0.008166644000272283 0.009322628116274939 https://leetcode.com/problems/decode-string https://leetcode.com/problems/valid-anagram
33 151 394 Reverse Words in a String Decode String 21.9% 50.0% Medium Medium 0.003456091915988908 0.008166644000272283 https://leetcode.com/problems/reverse-words-in-a-string https://leetcode.com/problems/decode-string
34 381 151 Insert Delete GetRandom O(1) - Duplicates allowed Reverse Words in a String 34.1% 21.9% Hard Medium 0 0.003456091915988908 https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed https://leetcode.com/problems/reverse-words-in-a-string
35 443 381 String Compression Insert Delete GetRandom O(1) - Duplicates allowed 41.3% 34.1% Easy Hard 0 0 https://leetcode.com/problems/string-compression https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
36 1436 443 Destination City String Compression 77.3% 41.3% Easy Easy 0 0 https://leetcode.com/problems/destination-city https://leetcode.com/problems/string-compression
37 1455 1436 Check If a Word Occurs As a Prefix of Any Word in a Sentence Destination City 64.6% 77.3% Easy Easy 0 0 https://leetcode.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence https://leetcode.com/problems/destination-city
38 1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence 64.6% Easy 0 https://leetcode.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence