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,27 +1,28 @@
695,Max Area of Island,62.7%,Medium,0.20952332409775687, https://leetcode.com/problems/max-area-of-island
127,Word Ladder,29.6%,Medium,0.1667080439422554, https://leetcode.com/problems/word-ladder
42,Trapping Rain Water,48.9%,Hard,0.12389276378675394, https://leetcode.com/problems/trapping-rain-water
1041,Robot Bounded In Circle,49.6%,Medium,0.10573219378884732, https://leetcode.com/problems/robot-bounded-in-circle
200,Number of Islands,46.8%,Medium,0.09910455319823885, https://leetcode.com/problems/number-of-islands
449,Serialize and Deserialize BST,52.0%,Medium,0.08696405427235052, https://leetcode.com/problems/serialize-and-deserialize-bst
139,Word Break,40.1%,Medium,0.07605014611885268, https://leetcode.com/problems/word-break
173,Binary Search Tree Iterator,56.6%,Medium,0.07392527369701565, https://leetcode.com/problems/binary-search-tree-iterator
103,Binary Tree Zigzag Level Order Traversal,48.3%,Medium,0.0697534935244004, https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
138,Copy List with Random Pointer,36.4%,Medium,0.05438585262874796, https://leetcode.com/problems/copy-list-with-random-pointer
13,Roman to Integer,55.7%,Easy,0.04121346863130292, https://leetcode.com/problems/roman-to-integer
722,Remove Comments,34.6%,Medium,0.04049136135473691, https://leetcode.com/problems/remove-comments
729,My Calendar I,51.8%,Medium,0.036433902246102004, https://leetcode.com/problems/my-calendar-i
332,Reconstruct Itinerary,36.7%,Medium,0.030687713231237448, https://leetcode.com/problems/reconstruct-itinerary
119,Pascal's Triangle II,49.0%,Easy,0.026565907037593445, https://leetcode.com/problems/pascals-triangle-ii
733,Flood Fill,55.3%,Easy,0.02506396866321625, https://leetcode.com/problems/flood-fill
131,Palindrome Partitioning,47.5%,Medium,0.013903595538577326, https://leetcode.com/problems/palindrome-partitioning
767,Reorganize String,48.7%,Medium,0.01329806830463147, https://leetcode.com/problems/reorganize-string
208,Implement Trie (Prefix Tree),49.4%,Medium,0.009105457856626612, https://leetcode.com/problems/implement-trie-prefix-tree
295,Find Median from Data Stream,44.3%,Hard,0.00899893586856953, https://leetcode.com/problems/find-median-from-data-stream
238,Product of Array Except Self,60.1%,Medium,0.008821856860216758, https://leetcode.com/problems/product-of-array-except-self
15,3Sum,26.8%,Medium,0.00876717944353383, https://leetcode.com/problems/3sum
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.007077170374085099, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
543,Diameter of Binary Tree,48.4%,Easy,0.005305755914149804, https://leetcode.com/problems/diameter-of-binary-tree
69,Sqrt(x),33.9%,Easy,0.005102051883895465, https://leetcode.com/problems/sqrtx
34,Find First and Last Position of Element in Sorted Array,36.2%,Medium,0.004247643638268045, https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
49,Group Anagrams,56.9%,Medium,0.0038040939835560453, https://leetcode.com/problems/group-anagrams
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
695,Max Area of Island,62.7%,Medium,0.20952332409775687, https://leetcode.com/problems/max-area-of-island
127,Word Ladder,29.6%,Medium,0.1667080439422554, https://leetcode.com/problems/word-ladder
42,Trapping Rain Water,48.9%,Hard,0.12389276378675394, https://leetcode.com/problems/trapping-rain-water
1041,Robot Bounded In Circle,49.6%,Medium,0.10573219378884732, https://leetcode.com/problems/robot-bounded-in-circle
200,Number of Islands,46.8%,Medium,0.09910455319823885, https://leetcode.com/problems/number-of-islands
449,Serialize and Deserialize BST,52.0%,Medium,0.08696405427235052, https://leetcode.com/problems/serialize-and-deserialize-bst
139,Word Break,40.1%,Medium,0.07605014611885268, https://leetcode.com/problems/word-break
173,Binary Search Tree Iterator,56.6%,Medium,0.07392527369701565, https://leetcode.com/problems/binary-search-tree-iterator
103,Binary Tree Zigzag Level Order Traversal,48.3%,Medium,0.0697534935244004, https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
138,Copy List with Random Pointer,36.4%,Medium,0.05438585262874796, https://leetcode.com/problems/copy-list-with-random-pointer
13,Roman to Integer,55.7%,Easy,0.04121346863130292, https://leetcode.com/problems/roman-to-integer
722,Remove Comments,34.6%,Medium,0.04049136135473691, https://leetcode.com/problems/remove-comments
729,My Calendar I,51.8%,Medium,0.036433902246102004, https://leetcode.com/problems/my-calendar-i
332,Reconstruct Itinerary,36.7%,Medium,0.030687713231237448, https://leetcode.com/problems/reconstruct-itinerary
119,Pascal's Triangle II,49.0%,Easy,0.026565907037593445, https://leetcode.com/problems/pascals-triangle-ii
733,Flood Fill,55.3%,Easy,0.02506396866321625, https://leetcode.com/problems/flood-fill
131,Palindrome Partitioning,47.5%,Medium,0.013903595538577326, https://leetcode.com/problems/palindrome-partitioning
767,Reorganize String,48.7%,Medium,0.01329806830463147, https://leetcode.com/problems/reorganize-string
208,Implement Trie (Prefix Tree),49.4%,Medium,0.009105457856626612, https://leetcode.com/problems/implement-trie-prefix-tree
295,Find Median from Data Stream,44.3%,Hard,0.00899893586856953, https://leetcode.com/problems/find-median-from-data-stream
238,Product of Array Except Self,60.1%,Medium,0.008821856860216758, https://leetcode.com/problems/product-of-array-except-self
15,3Sum,26.8%,Medium,0.00876717944353383, https://leetcode.com/problems/3sum
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.007077170374085099, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
543,Diameter of Binary Tree,48.4%,Easy,0.005305755914149804, https://leetcode.com/problems/diameter-of-binary-tree
69,Sqrt(x),33.9%,Easy,0.005102051883895465, https://leetcode.com/problems/sqrtx
34,Find First and Last Position of Element in Sorted Array,36.2%,Medium,0.004247643638268045, https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
49,Group Anagrams,56.9%,Medium,0.0038040939835560453, https://leetcode.com/problems/group-anagrams
1 695 ID Max Area of Island Title 62.7% Acceptance Medium Difficulty 0.20952332409775687 Frequency https://leetcode.com/problems/max-area-of-island Leetcode Question Link
2 127 695 Word Ladder Max Area of Island 29.6% 62.7% Medium Medium 0.1667080439422554 0.20952332409775687 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/max-area-of-island
3 42 127 Trapping Rain Water Word Ladder 48.9% 29.6% Hard Medium 0.12389276378675394 0.1667080439422554 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/word-ladder
4 1041 42 Robot Bounded In Circle Trapping Rain Water 49.6% 48.9% Medium Hard 0.10573219378884732 0.12389276378675394 https://leetcode.com/problems/robot-bounded-in-circle https://leetcode.com/problems/trapping-rain-water
5 200 1041 Number of Islands Robot Bounded In Circle 46.8% 49.6% Medium Medium 0.09910455319823885 0.10573219378884732 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/robot-bounded-in-circle
6 449 200 Serialize and Deserialize BST Number of Islands 52.0% 46.8% Medium Medium 0.08696405427235052 0.09910455319823885 https://leetcode.com/problems/serialize-and-deserialize-bst https://leetcode.com/problems/number-of-islands
7 139 449 Word Break Serialize and Deserialize BST 40.1% 52.0% Medium Medium 0.07605014611885268 0.08696405427235052 https://leetcode.com/problems/word-break https://leetcode.com/problems/serialize-and-deserialize-bst
8 173 139 Binary Search Tree Iterator Word Break 56.6% 40.1% Medium Medium 0.07392527369701565 0.07605014611885268 https://leetcode.com/problems/binary-search-tree-iterator https://leetcode.com/problems/word-break
9 103 173 Binary Tree Zigzag Level Order Traversal Binary Search Tree Iterator 48.3% 56.6% Medium Medium 0.0697534935244004 0.07392527369701565 https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal https://leetcode.com/problems/binary-search-tree-iterator
10 138 103 Copy List with Random Pointer Binary Tree Zigzag Level Order Traversal 36.4% 48.3% Medium Medium 0.05438585262874796 0.0697534935244004 https://leetcode.com/problems/copy-list-with-random-pointer https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
11 13 138 Roman to Integer Copy List with Random Pointer 55.7% 36.4% Easy Medium 0.04121346863130292 0.05438585262874796 https://leetcode.com/problems/roman-to-integer https://leetcode.com/problems/copy-list-with-random-pointer
12 722 13 Remove Comments Roman to Integer 34.6% 55.7% Medium Easy 0.04049136135473691 0.04121346863130292 https://leetcode.com/problems/remove-comments https://leetcode.com/problems/roman-to-integer
13 729 722 My Calendar I Remove Comments 51.8% 34.6% Medium Medium 0.036433902246102004 0.04049136135473691 https://leetcode.com/problems/my-calendar-i https://leetcode.com/problems/remove-comments
14 332 729 Reconstruct Itinerary My Calendar I 36.7% 51.8% Medium Medium 0.030687713231237448 0.036433902246102004 https://leetcode.com/problems/reconstruct-itinerary https://leetcode.com/problems/my-calendar-i
15 119 332 Pascal's Triangle II Reconstruct Itinerary 49.0% 36.7% Easy Medium 0.026565907037593445 0.030687713231237448 https://leetcode.com/problems/pascals-triangle-ii https://leetcode.com/problems/reconstruct-itinerary
16 733 119 Flood Fill Pascal's Triangle II 55.3% 49.0% Easy Easy 0.02506396866321625 0.026565907037593445 https://leetcode.com/problems/flood-fill https://leetcode.com/problems/pascals-triangle-ii
17 131 733 Palindrome Partitioning Flood Fill 47.5% 55.3% Medium Easy 0.013903595538577326 0.02506396866321625 https://leetcode.com/problems/palindrome-partitioning https://leetcode.com/problems/flood-fill
18 767 131 Reorganize String Palindrome Partitioning 48.7% 47.5% Medium Medium 0.01329806830463147 0.013903595538577326 https://leetcode.com/problems/reorganize-string https://leetcode.com/problems/palindrome-partitioning
19 208 767 Implement Trie (Prefix Tree) Reorganize String 49.4% 48.7% Medium Medium 0.009105457856626612 0.01329806830463147 https://leetcode.com/problems/implement-trie-prefix-tree https://leetcode.com/problems/reorganize-string
20 295 208 Find Median from Data Stream Implement Trie (Prefix Tree) 44.3% 49.4% Hard Medium 0.00899893586856953 0.009105457856626612 https://leetcode.com/problems/find-median-from-data-stream https://leetcode.com/problems/implement-trie-prefix-tree
21 238 295 Product of Array Except Self Find Median from Data Stream 60.1% 44.3% Medium Hard 0.008821856860216758 0.00899893586856953 https://leetcode.com/problems/product-of-array-except-self https://leetcode.com/problems/find-median-from-data-stream
22 15 238 3Sum Product of Array Except Self 26.8% 60.1% Medium Medium 0.00876717944353383 0.008821856860216758 https://leetcode.com/problems/3sum https://leetcode.com/problems/product-of-array-except-self
23 297 15 Serialize and Deserialize Binary Tree 3Sum 47.5% 26.8% Hard Medium 0.007077170374085099 0.00876717944353383 https://leetcode.com/problems/serialize-and-deserialize-binary-tree https://leetcode.com/problems/3sum
24 543 297 Diameter of Binary Tree Serialize and Deserialize Binary Tree 48.4% 47.5% Easy Hard 0.005305755914149804 0.007077170374085099 https://leetcode.com/problems/diameter-of-binary-tree https://leetcode.com/problems/serialize-and-deserialize-binary-tree
25 69 543 Sqrt(x) Diameter of Binary Tree 33.9% 48.4% Easy Easy 0.005102051883895465 0.005305755914149804 https://leetcode.com/problems/sqrtx https://leetcode.com/problems/diameter-of-binary-tree
26 34 69 Find First and Last Position of Element in Sorted Array Sqrt(x) 36.2% 33.9% Medium Easy 0.004247643638268045 0.005102051883895465 https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array https://leetcode.com/problems/sqrtx
27 49 34 Group Anagrams Find First and Last Position of Element in Sorted Array 56.9% 36.2% Medium Medium 0.0038040939835560453 0.004247643638268045 https://leetcode.com/problems/group-anagrams https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
28 49 Group Anagrams 56.9% Medium 0.0038040939835560453 https://leetcode.com/problems/group-anagrams