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,38 +1,39 @@
1052,Grumpy Bookstore Owner,55.4%,Medium,0.8402346949345842, https://leetcode.com/problems/grumpy-bookstore-owner
991,Broken Calculator,45.6%,Medium,0.7270526032311205, https://leetcode.com/problems/broken-calculator
45,Jump Game II,30.6%,Hard,0.5749144034972855, https://leetcode.com/problems/jump-game-ii
457,Circular Array Loop,29.4%,Medium,0.4310822724784647, https://leetcode.com/problems/circular-array-loop
403,Frog Jump,39.7%,Hard,0.2789440727446297, https://leetcode.com/problems/frog-jump
402,Remove K Digits,28.4%,Medium,0.24067603007585034, https://leetcode.com/problems/remove-k-digits
826,Most Profit Assigning Work,38.5%,Medium,0.09287412500644375, https://leetcode.com/problems/most-profit-assigning-work
564,Find the Closest Palindrome,19.7%,Hard,0.0840831172105414, https://leetcode.com/problems/find-the-closest-palindrome
316,Remove Duplicate Letters,35.8%,Hard,0.067239661116769, https://leetcode.com/problems/remove-duplicate-letters
202,Happy Number,50.4%,Easy,0.05503451923624455, https://leetcode.com/problems/happy-number
33,Search in Rotated Sorted Array,34.5%,Medium,0.05046797817178903, https://leetcode.com/problems/search-in-rotated-sorted-array
273,Integer to English Words,27.1%,Hard,0.04747257415466348, https://leetcode.com/problems/integer-to-english-words
238,Product of Array Except Self,60.1%,Medium,0.04711503937510501, https://leetcode.com/problems/product-of-array-except-self
253,Meeting Rooms II,45.7%,Medium,0.03193246767820989, https://leetcode.com/problems/meeting-rooms-ii
703,Kth Largest Element in a Stream,49.7%,Easy,0.031004894819414507, https://leetcode.com/problems/kth-largest-element-in-a-stream
146,LRU Cache,33.2%,Medium,0.028411001832779885, https://leetcode.com/problems/lru-cache
40,Combination Sum II,48.2%,Medium,0.021424290044083395, https://leetcode.com/problems/combination-sum-ii
128,Longest Consecutive Sequence,45.1%,Hard,0.020252717433212362, https://leetcode.com/problems/longest-consecutive-sequence
55,Jump Game,34.6%,Medium,0.01994084020351079, https://leetcode.com/problems/jump-game
200,Number of Islands,46.8%,Medium,0.017925481766054456, https://leetcode.com/problems/number-of-islands
239,Sliding Window Maximum,43.0%,Hard,0.01768566434627554, https://leetcode.com/problems/sliding-window-maximum
17,Letter Combinations of a Phone Number,46.8%,Medium,0.017492519932499718, https://leetcode.com/problems/letter-combinations-of-a-phone-number
116,Populating Next Right Pointers in Each Node,45.2%,Medium,0.016432723251567683, https://leetcode.com/problems/populating-next-right-pointers-in-each-node
977,Squares of a Sorted Array,72.1%,Easy,0.015474196582597383, https://leetcode.com/problems/squares-of-a-sorted-array
621,Task Scheduler,50.1%,Medium,0.014546980601820143, https://leetcode.com/problems/task-scheduler
76,Minimum Window Substring,34.6%,Hard,0.013966707481708198, https://leetcode.com/problems/minimum-window-substring
138,Copy List with Random Pointer,36.4%,Medium,0.013876263355766411, https://leetcode.com/problems/copy-list-with-random-pointer
210,Course Schedule II,40.7%,Medium,0.011869857339029215, https://leetcode.com/problems/course-schedule-ii
283,Move Zeroes,57.8%,Easy,0.01149190266804209, https://leetcode.com/problems/move-zeroes
207,Course Schedule,43.1%,Medium,0.01113459480911671, https://leetcode.com/problems/course-schedule
234,Palindrome Linked List,39.3%,Easy,0.010171877938733932, https://leetcode.com/problems/palindrome-linked-list
22,Generate Parentheses,62.7%,Medium,0.009785877810632554, https://leetcode.com/problems/generate-parentheses
208,Implement Trie (Prefix Tree),49.4%,Medium,0.009105457856626612, https://leetcode.com/problems/implement-trie-prefix-tree
5,Longest Palindromic Substring,29.5%,Medium,0.005121212968082452, https://leetcode.com/problems/longest-palindromic-substring
49,Group Anagrams,56.9%,Medium,0.0038040939835560453, https://leetcode.com/problems/group-anagrams
1003,Check If Word Is Valid After Substitutions,55.3%,Medium,0, https://leetcode.com/problems/check-if-word-is-valid-after-substitutions
1156,Swap For Longest Repeated Character Substring,49.0%,Medium,0, https://leetcode.com/problems/swap-for-longest-repeated-character-substring
1157,Online Majority Element In Subarray,39.0%,Hard,0, https://leetcode.com/problems/online-majority-element-in-subarray
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1052,Grumpy Bookstore Owner,55.4%,Medium,0.8402346949345842, https://leetcode.com/problems/grumpy-bookstore-owner
991,Broken Calculator,45.6%,Medium,0.7270526032311205, https://leetcode.com/problems/broken-calculator
45,Jump Game II,30.6%,Hard,0.5749144034972855, https://leetcode.com/problems/jump-game-ii
457,Circular Array Loop,29.4%,Medium,0.4310822724784647, https://leetcode.com/problems/circular-array-loop
403,Frog Jump,39.7%,Hard,0.2789440727446297, https://leetcode.com/problems/frog-jump
402,Remove K Digits,28.4%,Medium,0.24067603007585034, https://leetcode.com/problems/remove-k-digits
826,Most Profit Assigning Work,38.5%,Medium,0.09287412500644375, https://leetcode.com/problems/most-profit-assigning-work
564,Find the Closest Palindrome,19.7%,Hard,0.0840831172105414, https://leetcode.com/problems/find-the-closest-palindrome
316,Remove Duplicate Letters,35.8%,Hard,0.067239661116769, https://leetcode.com/problems/remove-duplicate-letters
202,Happy Number,50.4%,Easy,0.05503451923624455, https://leetcode.com/problems/happy-number
33,Search in Rotated Sorted Array,34.5%,Medium,0.05046797817178903, https://leetcode.com/problems/search-in-rotated-sorted-array
273,Integer to English Words,27.1%,Hard,0.04747257415466348, https://leetcode.com/problems/integer-to-english-words
238,Product of Array Except Self,60.1%,Medium,0.04711503937510501, https://leetcode.com/problems/product-of-array-except-self
253,Meeting Rooms II,45.7%,Medium,0.03193246767820989, https://leetcode.com/problems/meeting-rooms-ii
703,Kth Largest Element in a Stream,49.7%,Easy,0.031004894819414507, https://leetcode.com/problems/kth-largest-element-in-a-stream
146,LRU Cache,33.2%,Medium,0.028411001832779885, https://leetcode.com/problems/lru-cache
40,Combination Sum II,48.2%,Medium,0.021424290044083395, https://leetcode.com/problems/combination-sum-ii
128,Longest Consecutive Sequence,45.1%,Hard,0.020252717433212362, https://leetcode.com/problems/longest-consecutive-sequence
55,Jump Game,34.6%,Medium,0.01994084020351079, https://leetcode.com/problems/jump-game
200,Number of Islands,46.8%,Medium,0.017925481766054456, https://leetcode.com/problems/number-of-islands
239,Sliding Window Maximum,43.0%,Hard,0.01768566434627554, https://leetcode.com/problems/sliding-window-maximum
17,Letter Combinations of a Phone Number,46.8%,Medium,0.017492519932499718, https://leetcode.com/problems/letter-combinations-of-a-phone-number
116,Populating Next Right Pointers in Each Node,45.2%,Medium,0.016432723251567683, https://leetcode.com/problems/populating-next-right-pointers-in-each-node
977,Squares of a Sorted Array,72.1%,Easy,0.015474196582597383, https://leetcode.com/problems/squares-of-a-sorted-array
621,Task Scheduler,50.1%,Medium,0.014546980601820143, https://leetcode.com/problems/task-scheduler
76,Minimum Window Substring,34.6%,Hard,0.013966707481708198, https://leetcode.com/problems/minimum-window-substring
138,Copy List with Random Pointer,36.4%,Medium,0.013876263355766411, https://leetcode.com/problems/copy-list-with-random-pointer
210,Course Schedule II,40.7%,Medium,0.011869857339029215, https://leetcode.com/problems/course-schedule-ii
283,Move Zeroes,57.8%,Easy,0.01149190266804209, https://leetcode.com/problems/move-zeroes
207,Course Schedule,43.1%,Medium,0.01113459480911671, https://leetcode.com/problems/course-schedule
234,Palindrome Linked List,39.3%,Easy,0.010171877938733932, https://leetcode.com/problems/palindrome-linked-list
22,Generate Parentheses,62.7%,Medium,0.009785877810632554, https://leetcode.com/problems/generate-parentheses
208,Implement Trie (Prefix Tree),49.4%,Medium,0.009105457856626612, https://leetcode.com/problems/implement-trie-prefix-tree
5,Longest Palindromic Substring,29.5%,Medium,0.005121212968082452, https://leetcode.com/problems/longest-palindromic-substring
49,Group Anagrams,56.9%,Medium,0.0038040939835560453, https://leetcode.com/problems/group-anagrams
1003,Check If Word Is Valid After Substitutions,55.3%,Medium,0, https://leetcode.com/problems/check-if-word-is-valid-after-substitutions
1156,Swap For Longest Repeated Character Substring,49.0%,Medium,0, https://leetcode.com/problems/swap-for-longest-repeated-character-substring
1157,Online Majority Element In Subarray,39.0%,Hard,0, https://leetcode.com/problems/online-majority-element-in-subarray
1 1052 ID Grumpy Bookstore Owner Title 55.4% Acceptance Medium Difficulty 0.8402346949345842 Frequency https://leetcode.com/problems/grumpy-bookstore-owner Leetcode Question Link
2 991 1052 Broken Calculator Grumpy Bookstore Owner 45.6% 55.4% Medium Medium 0.7270526032311205 0.8402346949345842 https://leetcode.com/problems/broken-calculator https://leetcode.com/problems/grumpy-bookstore-owner
3 45 991 Jump Game II Broken Calculator 30.6% 45.6% Hard Medium 0.5749144034972855 0.7270526032311205 https://leetcode.com/problems/jump-game-ii https://leetcode.com/problems/broken-calculator
4 457 45 Circular Array Loop Jump Game II 29.4% 30.6% Medium Hard 0.4310822724784647 0.5749144034972855 https://leetcode.com/problems/circular-array-loop https://leetcode.com/problems/jump-game-ii
5 403 457 Frog Jump Circular Array Loop 39.7% 29.4% Hard Medium 0.2789440727446297 0.4310822724784647 https://leetcode.com/problems/frog-jump https://leetcode.com/problems/circular-array-loop
6 402 403 Remove K Digits Frog Jump 28.4% 39.7% Medium Hard 0.24067603007585034 0.2789440727446297 https://leetcode.com/problems/remove-k-digits https://leetcode.com/problems/frog-jump
7 826 402 Most Profit Assigning Work Remove K Digits 38.5% 28.4% Medium Medium 0.09287412500644375 0.24067603007585034 https://leetcode.com/problems/most-profit-assigning-work https://leetcode.com/problems/remove-k-digits
8 564 826 Find the Closest Palindrome Most Profit Assigning Work 19.7% 38.5% Hard Medium 0.0840831172105414 0.09287412500644375 https://leetcode.com/problems/find-the-closest-palindrome https://leetcode.com/problems/most-profit-assigning-work
9 316 564 Remove Duplicate Letters Find the Closest Palindrome 35.8% 19.7% Hard Hard 0.067239661116769 0.0840831172105414 https://leetcode.com/problems/remove-duplicate-letters https://leetcode.com/problems/find-the-closest-palindrome
10 202 316 Happy Number Remove Duplicate Letters 50.4% 35.8% Easy Hard 0.05503451923624455 0.067239661116769 https://leetcode.com/problems/happy-number https://leetcode.com/problems/remove-duplicate-letters
11 33 202 Search in Rotated Sorted Array Happy Number 34.5% 50.4% Medium Easy 0.05046797817178903 0.05503451923624455 https://leetcode.com/problems/search-in-rotated-sorted-array https://leetcode.com/problems/happy-number
12 273 33 Integer to English Words Search in Rotated Sorted Array 27.1% 34.5% Hard Medium 0.04747257415466348 0.05046797817178903 https://leetcode.com/problems/integer-to-english-words https://leetcode.com/problems/search-in-rotated-sorted-array
13 238 273 Product of Array Except Self Integer to English Words 60.1% 27.1% Medium Hard 0.04711503937510501 0.04747257415466348 https://leetcode.com/problems/product-of-array-except-self https://leetcode.com/problems/integer-to-english-words
14 253 238 Meeting Rooms II Product of Array Except Self 45.7% 60.1% Medium Medium 0.03193246767820989 0.04711503937510501 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/product-of-array-except-self
15 703 253 Kth Largest Element in a Stream Meeting Rooms II 49.7% 45.7% Easy Medium 0.031004894819414507 0.03193246767820989 https://leetcode.com/problems/kth-largest-element-in-a-stream https://leetcode.com/problems/meeting-rooms-ii
16 146 703 LRU Cache Kth Largest Element in a Stream 33.2% 49.7% Medium Easy 0.028411001832779885 0.031004894819414507 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/kth-largest-element-in-a-stream
17 40 146 Combination Sum II LRU Cache 48.2% 33.2% Medium Medium 0.021424290044083395 0.028411001832779885 https://leetcode.com/problems/combination-sum-ii https://leetcode.com/problems/lru-cache
18 128 40 Longest Consecutive Sequence Combination Sum II 45.1% 48.2% Hard Medium 0.020252717433212362 0.021424290044083395 https://leetcode.com/problems/longest-consecutive-sequence https://leetcode.com/problems/combination-sum-ii
19 55 128 Jump Game Longest Consecutive Sequence 34.6% 45.1% Medium Hard 0.01994084020351079 0.020252717433212362 https://leetcode.com/problems/jump-game https://leetcode.com/problems/longest-consecutive-sequence
20 200 55 Number of Islands Jump Game 46.8% 34.6% Medium Medium 0.017925481766054456 0.01994084020351079 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/jump-game
21 239 200 Sliding Window Maximum Number of Islands 43.0% 46.8% Hard Medium 0.01768566434627554 0.017925481766054456 https://leetcode.com/problems/sliding-window-maximum https://leetcode.com/problems/number-of-islands
22 17 239 Letter Combinations of a Phone Number Sliding Window Maximum 46.8% 43.0% Medium Hard 0.017492519932499718 0.01768566434627554 https://leetcode.com/problems/letter-combinations-of-a-phone-number https://leetcode.com/problems/sliding-window-maximum
23 116 17 Populating Next Right Pointers in Each Node Letter Combinations of a Phone Number 45.2% 46.8% Medium Medium 0.016432723251567683 0.017492519932499718 https://leetcode.com/problems/populating-next-right-pointers-in-each-node https://leetcode.com/problems/letter-combinations-of-a-phone-number
24 977 116 Squares of a Sorted Array Populating Next Right Pointers in Each Node 72.1% 45.2% Easy Medium 0.015474196582597383 0.016432723251567683 https://leetcode.com/problems/squares-of-a-sorted-array https://leetcode.com/problems/populating-next-right-pointers-in-each-node
25 621 977 Task Scheduler Squares of a Sorted Array 50.1% 72.1% Medium Easy 0.014546980601820143 0.015474196582597383 https://leetcode.com/problems/task-scheduler https://leetcode.com/problems/squares-of-a-sorted-array
26 76 621 Minimum Window Substring Task Scheduler 34.6% 50.1% Hard Medium 0.013966707481708198 0.014546980601820143 https://leetcode.com/problems/minimum-window-substring https://leetcode.com/problems/task-scheduler
27 138 76 Copy List with Random Pointer Minimum Window Substring 36.4% 34.6% Medium Hard 0.013876263355766411 0.013966707481708198 https://leetcode.com/problems/copy-list-with-random-pointer https://leetcode.com/problems/minimum-window-substring
28 210 138 Course Schedule II Copy List with Random Pointer 40.7% 36.4% Medium Medium 0.011869857339029215 0.013876263355766411 https://leetcode.com/problems/course-schedule-ii https://leetcode.com/problems/copy-list-with-random-pointer
29 283 210 Move Zeroes Course Schedule II 57.8% 40.7% Easy Medium 0.01149190266804209 0.011869857339029215 https://leetcode.com/problems/move-zeroes https://leetcode.com/problems/course-schedule-ii
30 207 283 Course Schedule Move Zeroes 43.1% 57.8% Medium Easy 0.01113459480911671 0.01149190266804209 https://leetcode.com/problems/course-schedule https://leetcode.com/problems/move-zeroes
31 234 207 Palindrome Linked List Course Schedule 39.3% 43.1% Easy Medium 0.010171877938733932 0.01113459480911671 https://leetcode.com/problems/palindrome-linked-list https://leetcode.com/problems/course-schedule
32 22 234 Generate Parentheses Palindrome Linked List 62.7% 39.3% Medium Easy 0.009785877810632554 0.010171877938733932 https://leetcode.com/problems/generate-parentheses https://leetcode.com/problems/palindrome-linked-list
33 208 22 Implement Trie (Prefix Tree) Generate Parentheses 49.4% 62.7% Medium Medium 0.009105457856626612 0.009785877810632554 https://leetcode.com/problems/implement-trie-prefix-tree https://leetcode.com/problems/generate-parentheses
34 5 208 Longest Palindromic Substring Implement Trie (Prefix Tree) 29.5% 49.4% Medium Medium 0.005121212968082452 0.009105457856626612 https://leetcode.com/problems/longest-palindromic-substring https://leetcode.com/problems/implement-trie-prefix-tree
35 49 5 Group Anagrams Longest Palindromic Substring 56.9% 29.5% Medium Medium 0.0038040939835560453 0.005121212968082452 https://leetcode.com/problems/group-anagrams https://leetcode.com/problems/longest-palindromic-substring
36 1003 49 Check If Word Is Valid After Substitutions Group Anagrams 55.3% 56.9% Medium Medium 0 0.0038040939835560453 https://leetcode.com/problems/check-if-word-is-valid-after-substitutions https://leetcode.com/problems/group-anagrams
37 1156 1003 Swap For Longest Repeated Character Substring Check If Word Is Valid After Substitutions 49.0% 55.3% Medium Medium 0 0 https://leetcode.com/problems/swap-for-longest-repeated-character-substring https://leetcode.com/problems/check-if-word-is-valid-after-substitutions
38 1157 1156 Online Majority Element In Subarray Swap For Longest Repeated Character Substring 39.0% 49.0% Hard Medium 0 0 https://leetcode.com/problems/online-majority-element-in-subarray https://leetcode.com/problems/swap-for-longest-repeated-character-substring
39 1157 Online Majority Element In Subarray 39.0% Hard 0 https://leetcode.com/problems/online-majority-element-in-subarray